<?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 : Using Entity Linq with Custom Properties</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Using Entity Linq with Custom Properties</description>
  <pubDate>Tue, 14 Apr 2026 23:20:20 -700</pubDate>
  <lastBuildDate>Fri, 28 Jan 2011 12:19:43 -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=2457</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>Using Entity Linq with Custom Properties :  Hi mseeli;  I just discovered...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2457&amp;PID=9824#9824</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2457<br /><strong>Posted:</strong> 28-Jan-2011 at 12:19pm<br /><br /><p ="ms&#111;normal"=""><font ="Apple-style-span" size="2"><span style="color: black; ">Hi mseeli;</span><span ="Apple-style-span" style="line-height: 22px; ">&nbsp;</span></font></p><p ="ms&#111;normal"=""><font ="Apple-style-span" size="2"><span style="color: black; ">I just discovered that thefollowing can be done to create a dynamic OfType query, not quite a Linq onethough. Hope it can be useful to you in some ways.</span></font></p><p ="ms&#111;normal"=""><span style="color: black; "><font ="Apple-style-span" size="2">Employee - Master type<o:p></o:p></font></span></p><p ="ms&#111;normal"=""><font ="Apple-style-span" size="2"><span style="color: black; ">CurrentEmployee - Sub type ofEmployee</span></font></p><p ="ms&#111;normal"=""><span ="Apple-style-span" style="line-height: 18px; font-size: small; ">var typeToBeSelected =typeof(CurrentEmployee);</span></p><p ="ms&#111;normal"=""><span style="color: black; "><font ="Apple-style-span" size="2">var qBaseWeak =(IQueryable)TypeFns.ConstructGenericInstance(typeof(EntityQuery&lt;&gt;),entityType);<o:p></o:p></font></span></p><p ="ms&#111;normal"=""><font ="Apple-style-span" size="2"><span style="color: black; ">var rBaseWeak =mgr.ExecuteQuery((IEntityQuery)qBaseWeak);</span></font></p><p ="ms&#111;normal"=""><span style="color: black; "><font ="Apple-style-span" size="2">typeToBeSelected&nbsp;could bea sub type and when I tested it, it was able to retrieve the sub type withouthaving to retrieve all the master type first into the client.<o:p></o:p></font></span></p><p ="ms&#111;normal"=""><o:p><font ="Apple-style-span" size="2">&nbsp;</font></o:p></p>]]>
   </description>
   <pubDate>Fri, 28 Jan 2011 12:19:43 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2457&amp;PID=9824#9824</guid>
  </item> 
  <item>
   <title>Using Entity Linq with Custom Properties : Hi mseeli;You would actually need...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2457&amp;PID=9747#9747</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=912" rel="nofollow">DenisK</a><br /><strong>Subject:</strong> 2457<br /><strong>Posted:</strong> 21-Jan-2011 at 5:15pm<br /><br />Hi mseeli;<div><br></div><div>You would actually need to use OfType&lt;&gt; with your query. Constructing a dynamic OfType Linq query is currently not possible.&nbsp;</div><div><br></div><div>To create a similar function that runs on the server, you would need to create a server method and call that server method using EntityManager.InvokeServerMethod or EntityManager.InvokeServerMethodAsync. You can pass in the typeToBeSelected argument to that server method and run the same logic as&nbsp;</div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">var ordersOfCertainType = orders.Where(x=&gt;x.Type.IsOfType( typeToBeSelected));</span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; "><br></span></div><div><span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">Please see&nbsp;</span><a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/QueryRSMC" target="_blank">http://drc.ideablade.com/xwiki/bin/view/Documentation/QueryRSMC</a>&nbsp;for some code samples.</div><div><br></div><div>Hope this helps.</div>]]>
   </description>
   <pubDate>Fri, 21 Jan 2011 17:15:56 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2457&amp;PID=9747#9747</guid>
  </item> 
  <item>
   <title>Using Entity Linq with Custom Properties : I have a large number of orders.Each...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2457&amp;PID=9734#9734</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=945" rel="nofollow">mseeli</a><br /><strong>Subject:</strong> 2457<br /><strong>Posted:</strong> 21-Jan-2011 at 6:07am<br /><br />I have a large number of orders.<div>Each order is of a type.</div><div>The types are in a hierarchical tree: there is one master-type and then many branches and layers down of subtypes and sub-types of those and so on.</div><div>I want to be able to query the orders by selecting one type and getting back all the orders of this type plus all the orders that are of a subtype of this type (all the way down).</div><div><br></div><div>I created a property on the type called IsOfType(Type) in which I check if a type belongs to the branch of certain type.</div><div><br></div><div>It works fine. But I have to first get all the orders down to my client before I can use this property in a linq where statement</div><div><br></div><div><br></div><div>var ordersOfCertainType = orders.Where(x=&gt;x.Type.IsOfType( typeToBeSelected));</div><div><br></div><div>What I would like to do is to use my property in a Entity query i.e.:</div><div><br></div><div>manager.GetQuery&lt;Order&gt;.Where(.......) this does not work. Is there a way to get it to work with custom properties?&nbsp;</div><div><br></div><div>and if not how would I go about creating a function that runs on the server that does the selection before it sends the resulting orders over the wire.</div><div><br></div><div>thank you.&nbsp;</div>]]>
   </description>
   <pubDate>Fri, 21 Jan 2011 06:07:34 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2457&amp;PID=9734#9734</guid>
  </item> 
 </channel>
</rss>