<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="http://syndication.webwiz.co.uk/rss_namespace/">
 <channel>
  <title>DevForce Community Forum : OData Projection</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : OData Projection</description>
  <pubDate>Wed, 13 May 2026 11:30:20 -700</pubDate>
  <lastBuildDate>Wed, 11 Jan 2012 15:03:17 -700</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 9.69</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>www.ideablade.com/forum/RSS_post_feed.asp?TID=3207</WebWizForums:feedURL>
  <image>
   <title>DevForce Community Forum</title>
   <url>http://www.ideablade.com/forum/forum_images/IdeaBlade_logo_tm.png</url>
   <link>http://www.ideablade.com/forum/</link>
  </image>
  <item>
   <title>OData Projection : I was upset when I read that you...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12435#12435</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 3207<br /><strong>Posted:</strong> 11-Jan-2012 at 3:03pm<br /><br />I was upset when I read that you can't use navigation properties on ComplexTypes with WCF.<br><br>http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/b9e14bc6-b248-48e1-b9e3-af7600537110<br><br>With DevForce I was able to get it to work.<br><br>My complex types look like this:<br><br>AccountProjection<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int AccountId<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; IEnumerable&lt;ReceivableProjection&gt; Receivables<br><br>ReceivableProjection<br>&nbsp;&nbsp;&nbsp;&nbsp; int ReceivableId<br><br>By default, this will not work, you will get this error:<br><br>The server encountered an error processing the request. The exception message is 'The property 'Receivables' on a complex type 'AccountProjection' is not a valid property. Navigation properties are not supported on complex types.'. See server logs for more details.<br><br>To get past this I have simply added this to my entity manager partial class:<br><br><pre style="font-family:C&#111;nsolas;font-size:13;color:black;:white;">&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">public</span>&nbsp;<span style="color:#2b91af;">EntityQuery</span>&lt;<span style="color:#2b91af;">ReceivableProjection</span>&gt;&nbsp;ReceivableProjections&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">get</span>&nbsp;{&nbsp;<span style="color:blue;">return</span>&nbsp;<span style="color:blue;">null</span>;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;} &nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">public</span>&nbsp;<span style="color:#2b91af;">EntityQuery</span>&lt;<span style="color:#2b91af;">AccountProjection</span>&gt;&nbsp;AccountProjections&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">get</span>&nbsp;{&nbsp;<span style="color:blue;">return</span>&nbsp;<span style="color:blue;">null</span>;&nbsp;}&nbsp;&nbsp;&nbsp;&nbsp;}<br><br>Then I added this to my web service in InitializeService:<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; config.SetEntitySetAccessRule(<span style="color:#a31515;">"ReceivableProjections"</span>,&nbsp;<span style="color:#2b91af;">EntitySetRights</span>.All);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;config.SetEntitySetAccessRule(<span style="color:#a31515;">"AccountProjections"</span>,&nbsp;<span style="color:#2b91af;">EntitySetRights</span>.All);<br><br>Now it works, as long as I make sure to use $expand=Receivables in my query :)<br><br><br></pre><br>]]>
   </description>
   <pubDate>Wed, 11 Jan 2012 15:03:17 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12435#12435</guid>
  </item> 
  <item>
   <title>OData Projection :   Very cool. Thanks for sharing...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12432#12432</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3207<br /><strong>Posted:</strong> 11-Jan-2012 at 10:23am<br /><br />Very cool.&nbsp; Thanks for sharing this.]]>
   </description>
   <pubDate>Wed, 11 Jan 2012 10:23:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12432#12432</guid>
  </item> 
  <item>
   <title>OData Projection : It&amp;#039;s all working now :)I...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12424#12424</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 3207<br /><strong>Posted:</strong> 10-Jan-2012 at 7:33pm<br /><br />It's all working now :)<br><br>I created my projection class and marked it with the DataServiceKey. Then in my service I added this:<br><br><pre style="font-family:C&#111;nsolas;font-size:13;color:black;:white;">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&#091;<span style="color:#2b91af;">WebGet</span>&#093;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">public</span>&nbsp;<span style="color:#2b91af;">IQueryable</span>&lt;<span style="color:#2b91af;">AccountProjection</span>&gt;&nbsp;SearchAccounts(<span style="color:blue;">string</span>&nbsp;searchText)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<span style="color:blue;">var</span>&nbsp;accounts&nbsp;=&nbsp;<span style="color:blue;">this</span>.CurrentDataSource.Accounts&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Where(a&nbsp;=&gt;&nbsp;a.TaxAccountNumber.Contains(searchText))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Select(a&nbsp;=&gt;&nbsp;<span style="color:blue;">new</span>&nbsp;<span style="color:#2b91af;">AccountProjection</span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AccountId&nbsp;=&nbsp;a.AccountId,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;TaxAccountNumber&nbsp;=&nbsp;a.TaxAccountNumber&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}).ToList();<br><br>            //Use my procedure to get the info I need and update the projection<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <span style="color:blue;">return</span>&nbsp;accounts.AsQueryable();&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br><br>Then under InitializeService I added this line:<br>config.SetServiceOperationAccessRule(<span style="color:#a31515;">"SearchAccounts"</span>,<span style="color:#2b91af;">ServiceOperationRights</span>.AllRead);<br>Now I can do whatever I want to get the data, and return the projection class.<br><br></pre><br><span style="font-size:10px"><br /><br />Edited by smi-mark - 11-Jan-2012 at 7:45am</span>]]>
   </description>
   <pubDate>Tue, 10 Jan 2012 19:33:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12424#12424</guid>
  </item> 
  <item>
   <title>OData Projection :   Sure. DevForce has supported...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12423#12423</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 3207<br /><strong>Posted:</strong> 10-Jan-2012 at 6:42pm<br /><br />Sure.&nbsp; DevForce has supported anonymous projections with OData since version 6.0.9.&nbsp; I guess it might depend on which Javascript library you're using, but you can check out our OData.js sample (<a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/code-sample-odata-js" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/code-sample-odata-js</a>) which uses jQuery and datajs.&nbsp; The sample isn't using anonymous projections, but just add a "$select=" clause&nbsp;to a query.&nbsp; For example, "Customers?$select=CustomerId, CompanyName".<div>&nbsp;</div><div>I'm not so sure about a projection from a stored procedure though ....</div>]]>
   </description>
   <pubDate>Tue, 10 Jan 2012 18:42:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12423#12423</guid>
  </item> 
  <item>
   <title>OData Projection : Is there a way of using projections...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12417#12417</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=449" rel="nofollow">smi-mark</a><br /><strong>Subject:</strong> 3207<br /><strong>Posted:</strong> 10-Jan-2012 at 3:47pm<br /><br />Is there a way of using projections with OData? I'm working on a sample HTML5 app and I'd like to build a projection from a few entities and a stored procedure, then return this to the client. I know you can use views and such, but haven't seen anything about projections yet.<br>]]>
   </description>
   <pubDate>Tue, 10 Jan 2012 15:47:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=3207&amp;PID=12417#12417</guid>
  </item> 
 </channel>
</rss>