<?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 : AnonymousProjectionSelector doesn&#039;t work on Silverlight</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : AnonymousProjectionSelector doesn&#039;t work on Silverlight</description>
  <pubDate>Tue, 12 May 2026 20:33:00 -700</pubDate>
  <lastBuildDate>Fri, 04 Oct 2013 19:02:37 -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=4465</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>AnonymousProjectionSelector doesn&#039;t work on Silverlight : This is a bug, which was first...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4465&amp;PID=17022#17022</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=11" rel="nofollow">kimj</a><br /><strong>Subject:</strong> 4465<br /><strong>Posted:</strong> 04-Oct-2013 at 7:02pm<br /><br />This is a bug, which was first found and fixed in DevForce 2012.&nbsp; We don't normally port fixes reported in DF2012 back to DF2010 unless they've also been reported in DF2010.&nbsp; So, now that it has been, we'll get it fixed, most likely in the next release.]]>
   </description>
   <pubDate>Fri, 04 Oct 2013 19:02:37 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4465&amp;PID=17022#17022</guid>
  </item> 
  <item>
   <title>AnonymousProjectionSelector doesn&#039;t work on Silverlight : If I use the AnonymousProjectionSelector...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=4465&amp;PID=17021#17021</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> 4465<br /><strong>Posted:</strong> 04-Oct-2013 at 5:37pm<br /><br />If I use the AnonymousProjectionSelector to build up a dynamic select of an entity with a cache-only query in Silverlight, DevForce goes off into the ether and never returns.  If I wrap that in a Coroutine or Task, I'll get this lovely error right away (instead of going off into the ether):<br /><br /><table width="99%"><tr><td><pre class="BBcode"><br />Exception Type: System.Security.VerificationException.<br />Message: Operation could destabilize the runtime.<br />&nbsp;&nbsp;&nbsp;at _IB_MjVj_daMH2Mi_pAbAf..ctor()<br />&nbsp;&nbsp;&nbsp;at lambda_method(Closure , Contract )<br />&nbsp;&nbsp;&nbsp;at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()<br />&nbsp;&nbsp;&nbsp;at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)<br />&nbsp;&nbsp;&nbsp;at System.Linq.Enumerable.ToList&#091;TSource&#093;(IEnumerable`1 source)<br />&nbsp;&nbsp;&nbsp;at IdeaBlade.EntityModel.EntityQuery`1.ExecuteExpression()<br />&nbsp;&nbsp;&nbsp;at IdeaBlade.EntityModel.EntityQuery`1.ExecuteCacheQuery()<br />&nbsp;&nbsp;&nbsp;at IdeaBlade.EntityModel.EntityQueryFinder.ExecuteFind(Guid queryGuid)<br />&nbsp;&nbsp;&nbsp;at IdeaBlade.EntityModel.EntityQueryFinder.Execute()<br />&nbsp;&nbsp;&nbsp;at IdeaBlade.EntityModel.EntityManager.ExecuteQueryCore(IEntityQuery query, Boolean isAsync)<br />&nbsp;&nbsp;&nbsp;at IdeaBlade.EntityModel.EntityManager.ExecuteQuery(IEntityQuery query)<br /></pre></td></tr></table><br /><br />If I just use a ProjectionSelector instead, everything works fine.<br /><br />One note that if there isn't any cached data that matches the query, the anonymous projection selector does not cause this error.  Only if results are returned does it occur.<br /><br />The downside unfortunately to using the ProjectionSelector is that it doesn't seem to use the alias name for the column which makes it a real pain when I build a projection anonymously with several columns. <br /><br />This same technique works fine server-side when doing this SYNC.  I can obviously rewrite the Silverlight-side logic to use EntityAspect and just get the values off the entity directly but wondered why the AnonymousProjectionSelector doesn't work.<br /><br /><table width="99%"><tr><td><pre class="BBcode"><br />// build a selection hard-coding what the column is as a test<br />IProjectionSelector pps = new AnonymousProjectionSelector().Combine("ContractGroupSID", "ContractGroupSID");<br /><br />// in this example, I know I've loaded the entity with that key into cache<br />var rootQuery = EntityQueryBuilder.BuildQuery(new EntityKey(typeof(Contract), new object&#091;&#093;{412}));<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  <br />if (pps != null)<br />{<br />&nbsp;&nbsp;&nbsp;// add in the columns to be selected into the projection<br />&nbsp;&nbsp;&nbsp;var projectionQuery = rootQuery.Select(pps);<br /><br />&nbsp;&nbsp;&nbsp;// this never returns if it was built with AnonymousProjectionSelector<br />&nbsp;&nbsp;&nbsp;var projectionResults = manager.ExecuteQuery(projectionQuery.With(QueryStrategy.CacheOnly));<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;// just for testing purposes.  we won't get here if we use anonymous<br />&nbsp;&nbsp;&nbsp;&nbsp;foreach (object item in projectionResults)<br />&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if (item != null)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Type t = item.GetType();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />&nbsp;&nbsp;&nbsp;&nbsp;}<br />}<br /></pre></td></tr></table><br /><br />If we simply use this instead it works:<br /><table width="99%"><tr><td><pre class="BBcode"><br />IProjectionSelector pps = new ProjectionSelector("ContractGroupSID", "ContractGroupSID");<br /></pre></td></tr></table><br /><br />This is DevForce 2010 6.1.12.<br /><br />]]>
   </description>
   <pubDate>Fri, 04 Oct 2013 17:37:49 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=4465&amp;PID=17021#17021</guid>
  </item> 
 </channel>
</rss>