<?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 and POCOs</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : OData and POCOs</description>
  <pubDate>Wed, 29 Jul 2026 18:39:47 -700</pubDate>
  <lastBuildDate>Wed, 06 Apr 2011 12:08:09 -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=2599</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 and POCOs : Hi rallman,  Yes, it is possible...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2599&amp;PID=10400#10400</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2599<br /><strong>Posted:</strong> 06-Apr-2011 at 12:08pm<br /><br /><DIV>Hi rallman,</DIV><DIV>&nbsp;</DIV><DIV>Yes, it is possible to expose POCOs through OData.</DIV><DIV>&nbsp;</DIV><DIV>Try setting the DataServiceKey attribute in your Order class:</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;<FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&#091;</FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>DataServiceKey</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>(</FONT></FONT><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas><FONT color=#a31515 size=2 face=C&#111;nsolas>"OrderId"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>)&#093;</FONT></FONT></DIV><DIV><FONT size=2 face=C&#111;nsolas>&nbsp;<FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>public</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> </FONT></FONT><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas><FONT color=#0000ff size=2 face=C&#111;nsolas>class</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> </FONT></FONT><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas><FONT color=#2b91af size=2 face=C&#111;nsolas>Order</FONT></FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas>...</FONT></DIV><DIV>&nbsp;</DIV><DIV>I have also attached a simple solution demonstrating it.</DIV><DIV>&nbsp;</DIV><DIV><a href="http://www.ideablade.com/forum/uploads/892/ODataWithPoco.zip" target="_blank">uploads/892/ODataWithPoco.zip</A></DIV>]]>
   </description>
   <pubDate>Wed, 06 Apr 2011 12:08:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2599&amp;PID=10400#10400</guid>
  </item> 
  <item>
   <title>OData and POCOs :    Is it possible to access...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2599&amp;PID=10341#10341</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=750" rel="nofollow">rallman</a><br /><strong>Subject:</strong> 2599<br /><strong>Posted:</strong> 31-Mar-2011 at 8:12am<br /><br /><font color="#000000">Is it possible to access POCOs using OData? </font><div><font color="#000000"> </font></div><div><font color="#000000">If I do not include the IgnoreProperties statement, I receive the following error when invoking the OData service:</font></div><div><font color="#000000">The server encountered an error processing the request. The exception message is 'On data context type 'MyEntities', there is a top IQueryable property 'Orders' whose element type is not an entity type. Make sure that the IQueryable property is of entity type or specify the IgnoreProperties attribute on the data context type to ignore this property.'.</font></div><div><font color="#000000"> </font></div><div><font color="#000000">I made my POCOs a "first class citizen" by creating a partial class.</font></div><div><pre style="font-family: C&#111;nsolas;"><font color="#000000">&#091;<span>IgnoreProperties</span>(<span>"Orders"</span>)&#093; <span>//If this is removed, the OData service will not run</span> <br><span>public</span> <span>partial</span> <span>class</span> <span>MyEntities : IdeaBlade<span>.</span>EntityModel<span>.<span>EntityManager </span></span></span>{	<span>public</span> IdeaBlade<span>.</span>EntityModel<span>.</span><span>EntityQuery</span><span>&lt;</span><span>Order</span><span>&gt;</span> Orders {		<span>get</span> { <span>return</span> <span>new</span> IdeaBlade<span>.</span>EntityModel<span>.</span><span>EntityQuery</span><span>&lt;</span><span>Order</span><span>&gt;</span>(<span>"Orders"</span>, <span>this</span>); }	}<br>}<br><span>public</span> <span>partial</span> <span>class</span> <span>Order</span> : IdeaBlade<span>.</span>EntityModel<span>.</span><span>IKnownType</span> {	&#091;<span>Key</span>&#093;	<span>public</span> <span>int</span> OrderId { <span>get</span>; <span>set</span>; }<br>}</font></pre></div><div><font color="#000000"> </font></div><div><font color="#000000">Any ideas?</font></div><font color="#000000"></font><span style="font-size:10px"><br /><br />Edited by rallman - 31-Mar-2011 at 8:13am</span>]]>
   </description>
   <pubDate>Thu, 31 Mar 2011 08:12:15 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2599&amp;PID=10341#10341</guid>
  </item> 
 </channel>
</rss>