<?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 : From Class to Linq</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : From Class to Linq</description>
  <pubDate>Sat, 11 Apr 2026 12:33:51 -700</pubDate>
  <lastBuildDate>Fri, 23 Jul 2010 11:23:35 -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=1996</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>From Class to Linq : Queries in Silverlight (which...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1996&amp;PID=7783#7783</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=4" rel="nofollow">GregD</a><br /><strong>Subject:</strong> 1996<br /><strong>Posted:</strong> 23-Jul-2010 at 11:23am<br /><br />Queries in Silverlight (which I assume you're using since you posted in this forum) must be asynchronous unless directed against the local cache.  So the basic query would look something like this:<br /><br /><table width="99%"><tr><td><pre class="BBcode"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var vendorsQuery = entityManager.Vendors<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .OrderBy(v =&gt; v.VendorName);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;_em1.ExecuteQueryAsync&lt;Vendor&gt;(vendorsQuery, GotVendors, null);<br />...<br />&nbsp;&nbsp;&nbsp;&nbsp;private void GotVendors(EntityQueryOperation&lt;Vendor&gt; op) {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;ObservableCollection&lt;Vendor&gt; vendors = <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; new ObservableCollection&lt;Vendor&gt;();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;op.Results.ForEach(v =&gt; vendors.Add(v));<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /></pre></td></tr></table><br /><br />or using the anonymous method syntax,<br /><br /><table width="99%"><tr><td><pre class="BBcode"><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;var vendorsQuery = entityManager.Vendors<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .OrderBy(v =&gt; v.VendorName);<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;entityManager.ExecuteQueryAsync&lt;Vendor&gt;(vendorsQuery, op =&gt; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ObservableCollection&lt;Vendor&gt; vendors =<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new ObservableCollection&lt;Vendor&gt;();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; op.Results.ForEach(v =&gt; vendors.Add(v));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;},<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;null);<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br /></pre></td></tr></table><br /><br />If you want write a FetchVendors method, you'll need to pass it a callback method so it can "phone" your calling method back when the results have been returned from the asynchronous query operation. For an example of that, see the GetEmployeeWithTotalOrderRevenueAsyncMethod() mini-demo in the Silvermight MiniDemos solution for Object Persistence, described here:<br /><br /><a href="http://www.ideablade.com:8989/xwiki/bin/view/&#068;ocumentati&#111;n/Code_MiniDemosSilverlight_BusObjPersistence" target="_blank">DevForce 2010 Documentation » Business Object Persistence » Code Sample - Mini-Demos (Silverlight)</a><br />]]>
   </description>
   <pubDate>Fri, 23 Jul 2010 11:23:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1996&amp;PID=7783#7783</guid>
  </item> 
  <item>
   <title>From Class to Linq : I used to write a retrieval query...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=1996&amp;PID=7766#7766</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=202" rel="nofollow">BillG</a><br /><strong>Subject:</strong> 1996<br /><strong>Posted:</strong> 22-Jul-2010 at 4:43pm<br /><br />I used to write a retrieval query like this<DIV></DIV><DIV></DIV><DIV></DIV>EntityList&lt;Customer&gt; customers = myPM.GetEntities&lt;Customer&gt;(query);<DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>And then I would pass the customers object to a data grid.</DIV><DIV>&nbsp;</DIV><DIV>How do I do the same in Linq</DIV><DIV>&nbsp;</DIV><DIV>This is what I have so far:</DIV><DIV>&nbsp;</DIV><DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P></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>private</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>readonly</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>TicketWareEntities</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> entityManager = </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>TicketWareEntities</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>.DefaultManager;</P><P></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>public</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>ObservableCollection</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&lt;</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>Vendor</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&gt; Vendors { </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>get</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>private</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>set</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>; }</P><DIV></DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P></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>public</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&nbsp;</FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><FONT color=#cc0099 size=2 face=C&#111;nsolas>?????</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> FetchVendors()</P><P>{</P><P></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>var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> query = </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>from</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>Vendor</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>in</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> entityManager.Vendors</P><P></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>orderby</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> Vendor.VendorName</P><P></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>select</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> Vendor;</P><P></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><FONT color=#990066 size=2 face=C&#111;nsolas>?????</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&nbsp;= entityManager.ExecuteQuery&lt;</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>Vendor</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&gt;(query);</P><DIV>return <FONT color=#990000>?????</FONT></DIV><P></P><DIV>}</DIV></FONT></FONT></FONT></FONT></DIV>]]>
   </description>
   <pubDate>Thu, 22 Jul 2010 16:43:22 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=1996&amp;PID=7766#7766</guid>
  </item> 
 </channel>
</rss>