<?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 Projections, Navigation Properties and Fake Entity Managers</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Async Projections, Navigation Properties and Fake Entity Managers</description>
  <pubDate>Sun, 28 Jun 2026 08:51:45 -700</pubDate>
  <lastBuildDate>Thu, 23 Jun 2011 14:15:52 -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=2679</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 Projections, Navigation Properties and Fake Entity Managers : pk55;Yes you&amp;#039;re right. I&amp;#039;ve...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11087#11087</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> 2679<br /><strong>Posted:</strong> 23-Jun-2011 at 2:15pm<br /><br />pk55;<div><br></div><div>Yes you're right. I've submitted these 2 bugs with a high priority. I'll send you a patch as soon as they're available.</div>]]>
   </description>
   <pubDate>Thu, 23 Jun 2011 14:15:52 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11087#11087</guid>
  </item> 
  <item>
   <title>Async Projections, Navigation Properties and Fake Entity Managers : One last clarification; it seems...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11078#11078</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=543" rel="nofollow">pk55</a><br /><strong>Subject:</strong> 2679<br /><strong>Posted:</strong> 22-Jun-2011 at 5:33pm<br /><br />One last clarification; it seems that&nbsp;any SL CacheOnly query that uses a projection fails when trying to iterate over it or just sending it to a list.]]>
   </description>
   <pubDate>Wed, 22 Jun 2011 17:33:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11078#11078</guid>
  </item> 
  <item>
   <title>Async Projections, Navigation Properties and Fake Entity Managers : Yesa patch would be great, thanks...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11066#11066</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=543" rel="nofollow">pk55</a><br /><strong>Subject:</strong> 2679<br /><strong>Posted:</strong> 21-Jun-2011 at 7:11pm<br /><br />Yes&nbsp;a patch would be great, thanks for looking into this.]]>
   </description>
   <pubDate>Tue, 21 Jun 2011 19:11:04 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11066#11066</guid>
  </item> 
  <item>
   <title>Async Projections, Navigation Properties and Fake Entity Managers : Hi pk55;The previous posts were...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11065#11065</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> 2679<br /><strong>Posted:</strong> 21-Jun-2011 at 6:58pm<br /><br />Hi pk55;<div><br></div><div>The previous posts were talking about using Distinct with a POCO object on a projection. Your issue, although may sound similar, is actually different.&nbsp;</div><div><br></div><div>I've filed a bug report for this as well. This query apparently only fails in SL CacheOnly query. It works on 2-tier, n-tier and SL DataSource query. I'm assuming you want a patch for this as well once it becomes available?</div>]]>
   </description>
   <pubDate>Tue, 21 Jun 2011 18:58:23 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11065#11065</guid>
  </item> 
  <item>
   <title>Async Projections, Navigation Properties and Fake Entity Managers : Just upgraded to 6.1.1 and this...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11044#11044</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=543" rel="nofollow">pk55</a><br /><strong>Subject:</strong> 2679<br /><strong>Posted:</strong> 20-Jun-2011 at 10:01pm<br /><br />Just upgraded to 6.1.1 and this still isn't fixed.&nbsp; The Distinct iterator doesn't work even with a simple projection.&nbsp;]]>
   </description>
   <pubDate>Mon, 20 Jun 2011 22:01:27 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11044#11044</guid>
  </item> 
  <item>
   <title>Async Projections, Navigation Properties and Fake Entity Managers : Is this fixed in 6.1.0 or 6.1.1?...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11033#11033</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=543" rel="nofollow">pk55</a><br /><strong>Subject:</strong> 2679<br /><strong>Posted:</strong> 19-Jun-2011 at 12:08pm<br /><br /><P>Is this fixed in 6.1.0 or 6.1.1? I don't see anything in the release notes to indicate it was.&nbsp; The reason I ask is that in 6.0.9, using the Distinct on a simple projection fails.&nbsp; This is running on the Silverlight Client against cache only if that makes any difference.&nbsp; </P><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>//Try this in NorthwindIB (assuming you've already loaded the orders into the EM.</FONT></FONT></FONT></DIV><DIV><FONT color=#0000ff size=2 face=C&#111;nsolas>// both properties are ints and is the same thing I'm doing in our data model</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>var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> testing = _e</FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>ntityManager.Orders.With(</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>QueryStrategy</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>.CacheOnly)</FONT></FONT></DIV><DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>.Select(x =&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</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> {x.OrderID, x.EmployeeID}).Distinct();</FONT></FONT></DIV><DIV>&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>// will throw the exception on the first iteration</DIV><DIV><DIV>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> v </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> testing)</FONT></FONT></DIV><DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>{</FONT></FONT></DIV><DIV><FONT size=2><FONT face=C&#111;nsolas>&nbsp;&nbsp; <FONT color=#0000ff><FONT color=#0000ff><FONT color=#0000ff>if</FONT></FONT></FONT></FONT><FONT face=C&#111;nsolas> (v.EmployeeID &gt;= 0)</FONT></FONT></DIV><DIV><FONT size=2 face=C&#111;nsolas>&nbsp;&nbsp;&nbsp; {</FONT><FONT size=2 face=C&#111;nsolas>}</FONT></DIV><DIV><FONT size=2 face=C&#111;nsolas>}</FONT></DIV></DIV><BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr><DIV>&nbsp;</DIV><DIV>Exception Type: System.InvalidCastException<BR>Message: Unable to cast object of type '&lt;&gt;f__AnonymousType14`2&#091;System.Int32,System.Int32&#093;' to type '_IB_f__AnonymousType14`2g2sDsTuu_pDiPtoeb&#091;System.Int32,System.Int32&#093;'.<BR>Data: System.Collections.ListDictionaryInternal</DIV><DIV>StackTrace Information<BR>*********************************************<BR>&nbsp;&nbsp; at lambda_method(Closure , Object )<BR>&nbsp;&nbsp; at IdeaBlade.Core.AnonymousFns.&lt;DeconstructMany&gt;d__e.MoveNext()<BR>&nbsp;&nbsp; at IdeaBlade.Core.AnonymousFns.&lt;ConstructMany&gt;d__0.MoveNext()<BR>&nbsp;&nbsp; at System.Linq.Enumerable.&lt;CastIterator&gt;d__b1`1.MoveNext()<BR>&nbsp;&nbsp; at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)<BR>&nbsp;&nbsp; at System.Linq.Enumerable.ToList&#091;TSource&#093;(IEnumerable`1 source)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityQuery`1.ExecuteExpression()<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityQuery`1.ExecuteCacheQuery()<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityQueryFinder.ExecuteFind(Guid queryGuid)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityQueryFinder.Execute()<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityManager.ExecuteQueryCore(IEntityQuery query, Boolean isAsync)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityManager.ExecuteQuery&#091;T&#093;(IEntityQuery`1 query)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityQueryExtensions.Execute&#091;T&#093;(IEntityQuery`1 query)<BR>&nbsp;&nbsp; at IdeaBlade.EntityModel.EntityQuery`1.GetEnumerator()<BR></DIV></BLOCKQUOTE><DIV><BR>If instead I use GroupBy, it works fine except of course, the entire entity ends up being retrieved (it's not a projection anymore):</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>var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> testing = _e<FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>ntityManager.Orders.With(</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>QueryStrategy</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>.CacheOnly)</FONT></FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>.GroupBy(x =&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</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> {x.OrderID, x.EmployeeID}).Execute().ToList();</P><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>// will throw the exception on the first iteration</DIV><DIV><DIV>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> v </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> testing)</FONT></FONT></DIV><DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>{</FONT></FONT></DIV><DIV>&nbsp;&nbsp;&nbsp;// <FONT color=#0000ff>will</FONT> need to treat as key/value pair now</DIV><DIV><FONT size=2><FONT face=C&#111;nsolas>&nbsp;&nbsp; <FONT color=#0000ff><FONT color=#0000ff><FONT color=#0000ff>if</FONT></FONT></FONT></FONT><FONT face=C&#111;nsolas> (v.Key.EmployeeID &gt;= 0)</FONT></FONT></DIV><DIV><FONT size=2 face=C&#111;nsolas>&nbsp;&nbsp;&nbsp; {</FONT><FONT size=2 face=C&#111;nsolas>}</FONT></DIV><DIV><FONT size=2 face=C&#111;nsolas>}</FONT></DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV></DIV></DIV></FONT></FONT></DIV>]]>
   </description>
   <pubDate>Sun, 19 Jun 2011 12:08:01 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=11033#11033</guid>
  </item> 
  <item>
   <title>Async Projections, Navigation Properties and Fake Entity Managers : Thanks Denis, I&amp;#039;ll probably...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=10747#10747</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=701" rel="nofollow">JoeGershgorin</a><br /><strong>Subject:</strong> 2679<br /><strong>Posted:</strong> 18-May-2011 at 12:53pm<br /><br />Thanks Denis, I'll probably get an opportunity to get back to this issue&nbsp;tomorrow&nbsp;and will let you know. I've&nbsp;already&nbsp;implemented if/else workaround to use/notuse ToList() depending on the entity backing store, it will be nice to have a single code base for both backing stores when the bug is fixed, thanks.]]>
   </description>
   <pubDate>Wed, 18 May 2011 12:53:40 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=10747#10747</guid>
  </item> 
  <item>
   <title>Async Projections, Navigation Properties and Fake Entity Managers : Hi Joe;Problem 1 seems to be a...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=10731#10731</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> 2679<br /><strong>Posted:</strong> 17-May-2011 at 5:11pm<br /><br />Hi Joe;<div><br></div><div>Problem 1 seems to be a bug. I will file a bug report for this. For now, the workaround is to project a completely anonymous type and then create the new PasSummary POCO object from it. You also don't need to use .Include when doing projection. This is because projection query are done on the server so navigational properties can be fetched immediately.</div><div><br></div><div>Problem 2:</div><div><br></div><div>- The first LINQ to Entities exception is an EF limitation. In general, whenever you see this exception, it means that it's an EF limitation. This ToList() call works against the fake backing store because we're not working against EF in this environment.</div><div><br></div><div>- The second DistinctIterator exception is a bug. I will also file a bug report for this.</div><div><br></div><div>For now, the workaround for problem 2 is to switch between using .Distinct().ToList() and just .Distinct() between the fake and the non fake backing store. After the bug is fixed, the right way to do this is to just use .Distinct().</div><div><br></div><div>I hope this is clear. Please let me know if you need further clarification.</div>]]>
   </description>
   <pubDate>Tue, 17 May 2011 17:11:00 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=10731#10731</guid>
  </item> 
  <item>
   <title>Async Projections, Navigation Properties and Fake Entity Managers : Hi Joe;I&amp;#039;m going to repro...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=10720#10720</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> 2679<br /><strong>Posted:</strong> 17-May-2011 at 11:45am<br /><br /><div style=": rgb255, 255, 255; margin-left: 1px; margin-top: 1px; margin-right: 1px; margin-bottom: 1px; font-family: Verdana, Arial, Helvetica, sans-serif; color: rgb0, 0, 0; font-weight: normal; font-size: 12px; line-height: 1.4; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; -: n&#111;ne; ">Hi Joe;<div><br></div><div>I'm going to repro this on my machine and get back to you as soon as possible. Sorry for the delay.</div></div>]]>
   </description>
   <pubDate>Tue, 17 May 2011 11:45:16 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=10720#10720</guid>
  </item> 
  <item>
   <title>Async Projections, Navigation Properties and Fake Entity Managers : Running DevForce 6.0.9 under Silverlight...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=10686#10686</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=701" rel="nofollow">JoeGershgorin</a><br /><strong>Subject:</strong> 2679<br /><strong>Posted:</strong> 13-May-2011 at 6:41pm<br /><br /><div>Running DevForce 6.0.9 under Silverlight 4.</div><div><br></div><div>I have a POCO that is roughly structured like this (it's in my Silverlight domain model project and linked in the BOS domain model project):</div><div><br></div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>&#091;DataContract&#093;</div><div>public class PasSummary : IHasEntityAspect, IKnownType</div><div>{ &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &#091;Key&#093;</div><div>&nbsp; &nbsp; public Guid Id { get; set; }</div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; public PasNumber PasNumber { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; public int Number { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; public string Description { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; public string Function { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; public Decimal TotalHours { get; set; } &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</div><div>&nbsp;&nbsp;</div><div>&nbsp; &nbsp; &#091;DataMember&#093;</div><div>&nbsp; &nbsp; public IEnumerable&lt;Project&gt; Projects { get; set; }</div><div><br></div><div>&nbsp; &nbsp; &#091;IgnoreDataMember&#093;</div><div>&nbsp; &nbsp; public EntityAspect EntityAspect { get; set; } &nbsp; &nbsp; &nbsp; &nbsp;</div><div>}</div><div></pre></td></tr></table></div><div><br></div><div>I have an Async projection that roughly looks like this:</div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>&nbsp;var getEntriesForWeekOp = Manager.TimeSheetEntries</div><div>&nbsp; &nbsp; &nbsp; &nbsp; .Where(p =&gt;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; p.TimeSheet.UserId == _currentUser.Id &amp;&amp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; p.TimeSheet.WeekEndingDate == date.Date) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; .Include("TimeSheet")</div><div>&nbsp; &nbsp; &nbsp; &nbsp; .Include("Project.PasNumber.PasFunction")</div><div>&nbsp; &nbsp; &nbsp; &nbsp; .GroupBy(timeSheetEntry =&gt; timeSheetEntry.Project.PasNumber)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; .Include("Projects.PasNumber.PasFunction")</div><div>&nbsp; &nbsp; &nbsp; &nbsp; .Select(timeSheetEntries=&gt; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; new PasSummary{ &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TestObject = timeSheetEntries.ToList(), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; PasNumber = timeSheetEntries.FirstOrDefault().Project.PasNumber,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Number = &nbsp;timeSheetEntries.FirstOrDefault().Project.PasNumber.Number,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Description = timeSheetEntries.FirstOrDefault().Project.PasNumber.Description,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Function = timeSheetEntries.FirstOrDefault().Project.PasNumber.PasFunction.Name,</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Projects = timeSheetEntries.Select(entry=&gt;entry.Project).Distinct().ToList(), &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TotalHours = timeSheetEntries.Where(ts=&gt;ts.ActualHoursForWeek.HasValue)</div><div>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;.Select(tse=&gt;tse.ActualHoursForWeek.Value).Sum()</div><div>&nbsp; &nbsp; &nbsp; &nbsp; }) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</div><div>&nbsp; &nbsp; &nbsp; &nbsp; .ExecuteAsync();</div><div></pre></td></tr></table></div><div><br></div><div>Problem 1: (Navigation Properties)</div><div>The PasNumber is a entity type. It has a navigation property called PasFunction. If I project PasNumber into PasSummary's PasNumber property all the navigation properties are null. Ommiting or adding the includes has no effect. However if I project the navigation property values (Such as in the above Function property) the values feeds in fine. When using a fake entity manger backing store the PasFunction navigation property is retained.</div><div><br></div><div>Problem 2 : Projecting collections differences when using a fake entity manager backing store:</div><div><br></div><div>The assignment of the "Projects" property in PasSummary in the above projection throws with the following exception when using a real entity manager:</div><div><table width="99%"><tr><td><pre class="BBcode"></div><div>LINQ to Entities does not recognize the method 'System.Collections.Generic.List`1&#091;ProjectVisionModel.Project&#093; ToList&#091;Project&#093;(System.Collections.Generic.IEnumerable`1&#091;ProjectVisionModel.Project&#093;)' method, and this method cannot be translated into a store expression.</div><div></pre></td></tr></table></div><div><br></div><div>If I ommit the .ToList() the assignment works fine, but then when using the fake entity backing store causes the following exception:</div><div><table width="99%"><tr><td class="BBquote"></div><div>Type 'System.Linq.Enumerable+&lt;DistinctIterator&gt;d__81`1&#091;ProjectVisionModel.Project&#093;' cannot be serialized. Consider marking it with the DataContractAttribute attribute, and marking all of its members you want serialized with the DataMemberAttribute attribute. &nbsp;If the type is a collection, consider marking it with the CollectionDataContractAttribute. &nbsp;See the Microsoft .NET Framework documentation for other supported types.</td></tr></table></div><div><br></div><div>So it seems the fake backing store hates ommiting the .ToList() and the real entity manager hates it when the .ToList() is there.</div><div><br></div><div>Any feedback you could provide on the recommended way to deal with these issues would be appreciated, thanks.</div><div><br></div><div><br></div>]]>
   </description>
   <pubDate>Fri, 13 May 2011 18:41:35 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2679&amp;PID=10686#10686</guid>
  </item> 
 </channel>
</rss>