<?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 : Async anonymous LINQ query</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Async anonymous LINQ query</description>
  <pubDate>Wed, 10 Jun 2026 19:11:48 -700</pubDate>
  <lastBuildDate>Thu, 16 Sep 2010 18:35:02 -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=2120</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>Async anonymous LINQ query : Hi chuckc,   I tried an equivalentquery...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8537#8537</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 2120<br /><strong>Posted:</strong> 16-Sep-2010 at 6:35pm<br /><br />Hi chuckc, <DIV>&nbsp;</DIV><DIV>I tried an equivalent&nbsp;query and did not need the cast to the EntityQuery and was able to get the strong typing in the results.</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Thu, 16 Sep 2010 18:35:02 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8537#8537</guid>
  </item> 
  <item>
   <title>Async anonymous LINQ query : Here&amp;#039;s another related example...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8428#8428</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=705" rel="nofollow">chuckc</a><br /><strong>Subject:</strong> 2120<br /><strong>Posted:</strong> 10-Sep-2010 at 8:58am<br /><br /><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p>Here's another related example of where the type information isn't available in the async result. This scenario doesn't involve a GroupBy:</o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes"><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">var</SPAN> q0 = Repository.EntityManager.Certificates.Select(c =&gt;<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">new</SPAN> { PersonLastName = c.Provider.Person.LastName, </P><DIV>&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; PersonFirstName = c.Provider.Person.FirstName });<o:p></o:p></SPAN></DIV><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: blue">var</SPAN> i <SPAN style="COLOR: blue">in</SPAN> q0)<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> t = i.PersonLastName; <SPAN style="COLOR: green">// OK - is strongly typed</SPAN><o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>((<SPAN style="COLOR: #2b91af">EntityQuery</SPAN>)q0).ExecuteAsync(op =&gt;<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: blue">var</SPAN> i <SPAN style="COLOR: blue">in</SPAN> op.Results)<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>{<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">string</SPAN> t = i.PersonLastName; <SPAN style="COLOR: green">// FAIL - not strongly typed</SPAN><o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN>});<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P><P style="MARGIN: 0in 0in 10pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></SPAN></SPAN></P>]]>
   </description>
   <pubDate>Fri, 10 Sep 2010 08:58:36 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8428#8428</guid>
  </item> 
  <item>
   <title>Async anonymous LINQ query : Ok, after performing the GroupBy...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8418#8418</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 2120<br /><strong>Posted:</strong> 09-Sep-2010 at 3:05pm<br /><br />Ok, after performing the GroupBy you need to cast to an EntityQuery&lt;IGrouping&lt;string, EntityType&gt;&gt; to restore the type information.&nbsp; Here's an example:<DIV></DIV><DIV>&nbsp;</DIV><DIV><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="COLOR: green">// Perform the cast below to restore type information after the GroupBy</SPAN><?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="COLOR: blue">var</SPAN> query1 = (<SPAN style="COLOR: #2b91af">EntityQuery</SPAN>&lt;<SPAN style="COLOR: #2b91af">IGrouping</SPAN>&lt;<SPAN style="COLOR: blue">string</SPAN>, <SPAN style="COLOR: #2b91af">Customer</SPAN>&gt;&gt;)manager.Customers.GroupBy(c =&gt; c.Country);<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="COLOR: blue">var</SPAN> query2 = query1.Select(g =&gt; <SPAN style="COLOR: blue">new</SPAN> { Country = g.Key, Count = g.Count() });<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>query2.ExecuteAsync(op =&gt; {<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: blue">var</SPAN> anonItem <SPAN style="COLOR: blue">in</SPAN> op.Results) {<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">var</SPAN> country = anonItem.Country;<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">var</SPAN> count = anonItem.Count;<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>});<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>We'll look into the extension methods&nbsp;and see if&nbsp;we can do this automatically for you.</FONT></o:p></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p>&nbsp;</o:p></P></DIV>]]>
   </description>
   <pubDate>Thu, 09 Sep 2010 15:05:45 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8418#8418</guid>
  </item> 
  <item>
   <title>Async anonymous LINQ query : It looks like the GroupBy clause...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8406#8406</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 2120<br /><strong>Posted:</strong> 08-Sep-2010 at 6:25pm<br /><br />It looks like the GroupBy clause is breaking the inference and also forcing the cast to EntityQuery.&nbsp; I'll check with an architect tomorrow and see if there is a solution.&nbsp; Thanks for pointing this out!<DIV></DIV><DIV></DIV>]]>
   </description>
   <pubDate>Wed, 08 Sep 2010 18:25:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8406#8406</guid>
  </item> 
  <item>
   <title>Async anonymous LINQ query : I am seeing the same behavior,...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8402#8402</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=705" rel="nofollow">chuckc</a><br /><strong>Subject:</strong> 2120<br /><strong>Posted:</strong> 08-Sep-2010 at 12:10pm<br /><br />I am seeing the same behavior, that being that I have to cast my var query to an EntityQuery in order to call ExecuteAsync. &nbsp;And the collection returned in op.Results is not strongly typed. &nbsp;<div><br></div><div>Is there some other syntax required? &nbsp;</div><div><br></div><div>Or do you need to use the explicit event handler approach? &nbsp;Would *that* handle the anonymous type?</div><div><br></div>]]>
   </description>
   <pubDate>Wed, 08 Sep 2010 12:10:34 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8402#8402</guid>
  </item> 
  <item>
   <title>Async anonymous LINQ query : Ok, I still might be doing something...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8373#8373</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=916" rel="nofollow">BringerOD</a><br /><strong>Subject:</strong> 2120<br /><strong>Posted:</strong> 06-Sep-2010 at 3:25pm<br /><br /><P style="LINE-HEIGHT: normal; MARGIN: 0in 1.5pt 10pt; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>Ok, I still might be doing something wrong.<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 1.5pt 0pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>I&nbsp;think the type information is getting lost somewhere.&nbsp; I do not get back strongly typed anon collection back.<SPAN style="mso-spacerun: yes">&nbsp; </SPAN>I looked for it when I first tried this.&nbsp;<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 1.5pt 0pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 1.5pt 0pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>&nbsp;<o:p></o:p></SPAN></P><P style="LINE-HEIGHT: normal; MARGIN: 0in 1.5pt 0.75pt" =Ms&#111;normal><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>This might have to do with the fact that I have to cast the first group by query back to "</SPAN><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: #2b91af; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN>EntityQuery"</SPAN><SPAN style="FONT-FAMILY: 'Verdana','sans-serif'; COLOR: black; FONT-SIZE: 9pt; mso-fareast-font-family: 'Times New Roman'; mso-bidi-font-family: 'Times New Roman'; mso-ansi-: EN" lang=EN><o:p></o:p></SPAN></P>]]>
   </description>
   <pubDate>Mon, 06 Sep 2010 15:25:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8373#8373</guid>
  </item> 
  <item>
   <title>Async anonymous LINQ query : Nice. Good to see that you&amp;#039;re...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8352#8352</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=477" rel="nofollow">ting</a><br /><strong>Subject:</strong> 2120<br /><strong>Posted:</strong> 03-Sep-2010 at 12:54pm<br /><br /><DIV>Nice.&nbsp; Good to see that you're using some of the advanced DevForce features.</DIV><DIV>&nbsp;</DIV><DIV>The op.Results collection is actually strongly typed, so you can directly reference the properties.&nbsp; For example:</DIV><DIV>&nbsp;</DIV><DIV><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN><SPAN style="COLOR: blue">var</SPAN> query = manager.Customers.Select(</P><DIV>&nbsp;&nbsp;&nbsp; c =&gt; <SPAN style="COLOR: blue">new</SPAN> { CompanyName = c.CompanyName, Customer = c, Orders = c.Orders }</DIV><DIV>&nbsp;&nbsp;);<?: prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></SPAN></DIV><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>query.ExecuteAsync(op =&gt; {<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">foreach</SPAN> (<SPAN style="COLOR: blue">var</SPAN> anonItem <SPAN style="COLOR: blue">in</SPAN> op.Results) { <SPAN style="COLOR: green">// op.Results is IEnumerable&lt;a'&gt; strongly typed anon collection</SPAN><o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">var</SPAN> companyName = anonItem.CompanyName;<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">var</SPAN> customer = anonItem.Customer;<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; </SPAN><SPAN style="COLOR: blue">var</SPAN> orders = anonItem.Orders;<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp;&nbsp;&nbsp; </SPAN>}<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><SPAN style="mso-spacerun: yes">&nbsp; </SPAN>});<o:p></o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt; mso-layout-grid-align: n&#111;ne" =Ms&#111;normal><SPAN style="FONT-FAMILY: C&#111;nsolas; FONT-SIZE: 9.5pt"><o:p>&nbsp;</o:p></SPAN></P><P style="MARGIN: 0in 0in 0pt" =Ms&#111;normal><o:p><FONT size=3 face=Calibri>&nbsp;</FONT></o:p></P></DIV><span style="font-size:10px"><br /><br />Edited by ting - 08-Sep-2010 at 6:14pm</span>]]>
   </description>
   <pubDate>Fri, 03 Sep 2010 12:54:06 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8352#8352</guid>
  </item> 
  <item>
   <title>Async anonymous LINQ query : What is the best practice for...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8334#8334</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=916" rel="nofollow">BringerOD</a><br /><strong>Subject:</strong> 2120<br /><strong>Posted:</strong> 03-Sep-2010 at 7:32am<br /><br /><P>What is the best practice for getting results&nbsp;of an async anonymous LINQ query? </P><DIV></DIV><DIV>Just for the record its cool that you can even get this far. Becuase that means DevForce is sending that query to the server and atleast getting back results, where RIA <strong>cannot</strong> do this.</DIV><DIV>&nbsp;</DIV><DIV>This code works below, just want to make sure this is the best practice.</DIV><DIV>&nbsp;</DIV><DIV>Bryan</DIV><DIV><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></FONT></FONT></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff size=2 face=C&#111;nsolas></FONT>&nbsp;</DIV><DIV><FONT color=#0000ff size=2 face=C&#111;nsolas>-----------------------------------------------------------------------------</FONT></DIV><DIV><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></FONT></FONT></FONT>&nbsp;</DIV><DIV><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><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>var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> query1 = PrimeEntities.LeadListings</P><P>.Where(l =&gt; l.GroupId == LoggedIntUser.GroupId)</P><P>.GroupBy(l =&gt; l.StatusName).Select(g =&gt; </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>new</P></FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P>{</P><P>g.FirstOrDefault().DisplayOrder,</P><P>StatusId = g.FirstOrDefault().StatusId.Value,</P><P>StatusName = g.Key,</P><P>TotalLeads = g.Count(),</P><P>g.FirstOrDefault().FontColor,</P><P>g.FirstOrDefault().BackgroundColor</P><P>});</P><P>((</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>EntityQuery</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>) query1).ExecuteAsync((op) =&gt;</P><P>{</P><P>StatusGroupDtos.Clear();</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>foreach</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>var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> result </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> op.Results)</P><P>{</P><P></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>Type</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> type = result.GetType();</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> newItem = </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>new</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>LeadStatusGroupDto</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>();</P><P>newItem.StatusId = (</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>Guid</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>) type.GetProperty(</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>"StatusId"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>).GetValue(result, </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>null</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><P>newItem.StatusName = (</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>string</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>) type.GetProperty(</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>"StatusName"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>).GetValue(result, </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>null</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><P>newItem.TotalLeads = (</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>int</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>) type.GetProperty(</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>"TotalLeads"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>).GetValue(result, </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>null</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><P>newItem.FontColor = (</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>string</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>) type.GetProperty(</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>"FontColor"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>).GetValue(result, </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>null</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><P>newItem.BackgroundColor = (</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>string</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>) type.GetProperty(</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>"BackgroundColor"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>).GetValue(result, </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>null</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><P>newItem.DisplayOrder = (</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>int</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>?) type.GetProperty(</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>"DisplayOrder"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>).GetValue(result, </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>null</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P><P>StatusGroupDtos.Add(newItem);</P><P>}</P><P>});</P></FONT></FONT></FONT></FONT></FONT></DIV>]]>
   </description>
   <pubDate>Fri, 03 Sep 2010 07:32:59 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2120&amp;PID=8334#8334</guid>
  </item> 
 </channel>
</rss>