<?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 : Query for Ids In (...)</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Query for Ids In (...)</description>
  <pubDate>Wed, 10 Jun 2026 15:41:57 -700</pubDate>
  <lastBuildDate>Mon, 23 Aug 2010 12:29:27 -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=2080</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>Query for Ids In (...) : Thanks, KimJ. That will teach...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8149#8149</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 2080<br /><strong>Posted:</strong> 23-Aug-2010 at 12:29pm<br /><br />Thanks, KimJ. That will teach me to answer questions with bits no one has. Sorry folks.]]>
   </description>
   <pubDate>Mon, 23 Aug 2010 12:29:27 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8149#8149</guid>
  </item> 
  <item>
   <title>Query for Ids In (...) : Excellent! It&amp;#039;s working now....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8148#8148</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=902" rel="nofollow">EisenbergEffect</a><br /><strong>Subject:</strong> 2080<br /><strong>Posted:</strong> 23-Aug-2010 at 12:26pm<br /><br />Excellent! It's working now.]]>
   </description>
   <pubDate>Mon, 23 Aug 2010 12:26:45 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8148#8148</guid>
  </item> 
  <item>
   <title>Query for Ids In (...) : Support for Contains was added...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8143#8143</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> 2080<br /><strong>Posted:</strong> 23-Aug-2010 at 11:13am<br /><br />Support for Contains was added in current bits and will be available in release 6.0.5 coming in a few weeks.&nbsp; To work around that now you can manually add your collection&nbsp;type as a known type.&nbsp; You can do this by implementing an IKnownTypeProvider, or adding a&nbsp;KnownType attribute for the type of your collection to an existing type.&nbsp; Eg, <DIV>&nbsp;</DIV><DIV>&#091;KnownType(typeof(List&lt;int&gt;))&#093;</DIV><DIV>public partial class SomeEntity { }</DIV>]]>
   </description>
   <pubDate>Mon, 23 Aug 2010 11:13:51 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8143#8143</guid>
  </item> 
  <item>
   <title>Query for Ids In (...) : The technique described here definitely...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8142#8142</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 2080<br /><strong>Posted:</strong> 23-Aug-2010 at 10:25am<br /><br />The technique described here definitely works ... on all of our machines. Something is not quite right in your environment. Following up with you outside the forum. I'll be back with the resolution for our genernal audience.]]>
   </description>
   <pubDate>Mon, 23 Aug 2010 10:25:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8142#8142</guid>
  </item> 
  <item>
   <title>Query for Ids In (...) :  Unfortunately, this does not...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8139#8139</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=902" rel="nofollow">EisenbergEffect</a><br /><strong>Subject:</strong> 2080<br /><strong>Posted:</strong> 23-Aug-2010 at 7:05am<br /><br />Unfortunately, this does not work. I've tried it with Arrays, Lists, Observables and just using the ToQueryable method. The result is always the same. I get an error such as the following:<div><br></div><div>There was an error while trying to serialize parameter http://ideablade.com/EntityModel:entityQuerySurrogate. The InnerException message was 'Type 'System.Collections.Generic.List`1&#091;&#091;System.Int32, mscorlib, Version=2.0.5.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e&#093;&#093;' with data contract name 'ArrayOfint:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.'. &nbsp;Please see InnerException for more details.</div><div><br></div><div>I'm using version 6.0.4</div><span style="font-size:10px"><br /><br />Edited by EisenbergEffect - 23-Aug-2010 at 7:12am</span>]]>
   </description>
   <pubDate>Mon, 23 Aug 2010 07:05:07 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8139#8139</guid>
  </item> 
  <item>
   <title>Query for Ids In (...) : Ok ... I know you want to see...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8127#8127</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 2080<br /><strong>Posted:</strong> 20-Aug-2010 at 6:50pm<br /><br />Ok ... I know you want to see the async version. I ran in it async in the Desktop ... would be same in Silverlight except for the Silverlight Unit Test Framework goo would be different than my goo.<DIV>&nbsp;</DIV><DIV><PRE style="FONT-FAMILY: c&#111;nsolas">&nbsp;&nbsp;&nbsp;&nbsp;&#091;<SPAN style="COLOR: #2b91af">TestMethod</SPAN>,&nbsp;<SPAN style="COLOR: #2b91af">Asynchronous</SPAN>,&nbsp;<SPAN style="COLOR: #2b91af">Timeout</SPAN>(15000)&#093;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">public</SPAN>&nbsp;<SPAN style="COLOR: blue">void</SPAN>&nbsp;then_can_get_employees_asynchronously_by_id_list()&nbsp;{<BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;DoItAsync(<SPAN style="COLOR: blue">delegate</SPAN>&nbsp;{<BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">var</SPAN>&nbsp;mgr&nbsp;=&nbsp;CreateNewConnectedManager();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">var</SPAN>&nbsp;idArray&nbsp;=&nbsp;<SPAN style="COLOR: blue">new</SPAN>&#091;&#093;&nbsp;{&nbsp;1,&nbsp;3,&nbsp;5&nbsp;};&nbsp;<SPAN style="COLOR: green">//&nbsp;won't&nbsp;work&nbsp;with&nbsp;arrays</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">var</SPAN>&nbsp;idList&nbsp;=&nbsp;idArray.ToList();&nbsp;<SPAN style="COLOR: green">//&nbsp;&nbsp;&nbsp;but&nbsp;works&nbsp;fine&nbsp;with&nbsp;a&nbsp;list</SPAN><BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">var</SPAN>&nbsp;op&nbsp;=&nbsp;mgr.Employees<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Where(emp&nbsp;=&gt;&nbsp;idList.Contains(emp.EmployeeID))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ExecuteAsync();<BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;op.Completed&nbsp;+=&nbsp;(s,&nbsp;args)&nbsp;=&gt;&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: #2b91af">Assert</SPAN>.IsFalse(args.HasError,&nbsp;<SPAN style="COLOR: #a31515">"Query&nbsp;exception:&nbsp;"</SPAN>&nbsp;+&nbsp;args.Error);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">var</SPAN>&nbsp;emps&nbsp;=&nbsp;args.Results;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;emps.Count().ShouldEqual(3);<BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Done();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;};<BR> <BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;});<BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;}</PRE></DIV>]]>
   </description>
   <pubDate>Fri, 20 Aug 2010 18:50:18 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8127#8127</guid>
  </item> 
  <item>
   <title>Query for Ids In (...) : Found out why your example didn&amp;#039;t...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8126#8126</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=482" rel="nofollow">WardBell</a><br /><strong>Subject:</strong> 2080<br /><strong>Posted:</strong> 20-Aug-2010 at 6:47pm<br /><br />Found out why your example didn't work. The exception explains all ... <DIV>&nbsp;</DIV><DIV>"System.InvalidOperationException: DevForce does not support 'Contains' for array types.&nbsp; Try converting the array to a List&lt;T&gt; with the Linq ToList() method."</DIV><DIV>&nbsp;</DIV><DIV>Perhaps you didn't look at that exception. Or perhaps I'm using a preview build of DF 6.0.5 which gives a much clearer explanation of the problem.</DIV><DIV>&nbsp;</DIV><DIV>Here's a synchronous query test that shows it works with a list of ids ... instead of the array. Yes ... the async query version of the test passes as well.</DIV><DIV><PRE style="FONT-FAMILY: c&#111;nsolas">&nbsp;&nbsp;&nbsp;&nbsp;&#091;<SPAN style="COLOR: #2b91af">TestMethod</SPAN>&#093;<BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">public</SPAN>&nbsp;<SPAN style="COLOR: blue">void</SPAN>&nbsp;then_can_get_employees_by_id_list()&nbsp;{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">var</SPAN>&nbsp;mgr&nbsp;=&nbsp;CreateNewConnectedManager();<BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">var</SPAN>&nbsp;idArray&nbsp;=&nbsp;<SPAN style="COLOR: blue">new</SPAN>&nbsp;&#091;&#093;&nbsp;{&nbsp;1,&nbsp;3,&nbsp;5};&nbsp;<SPAN style="COLOR: green">//&nbsp;won't&nbsp;work&nbsp;with&nbsp;arrays</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">var</SPAN>&nbsp;idList&nbsp;=&nbsp;idArray.ToList();&nbsp;<SPAN style="COLOR: green">//&nbsp;but&nbsp;works&nbsp;fine&nbsp;with&nbsp;a&nbsp;list</SPAN><BR> <BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN style="COLOR: blue">var</SPAN>&nbsp;emps&nbsp;=&nbsp;mgr.Employees<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.Where(emp&nbsp;=&gt;&nbsp;idList.Contains(emp.EmployeeID))<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.ToList();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;emps.Count.ShouldEqual(3);<BR>&nbsp;&nbsp;&nbsp;&nbsp;}</PRE></DIV>]]>
   </description>
   <pubDate>Fri, 20 Aug 2010 18:47:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8126#8126</guid>
  </item> 
  <item>
   <title>Query for Ids In (...) :     Here&amp;#039;s the sample...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8118#8118</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=902" rel="nofollow">EisenbergEffect</a><br /><strong>Subject:</strong> 2080<br /><strong>Posted:</strong> 20-Aug-2010 at 11:03am<br /><br />Here's the sample code I have been trying with no success:<div><br></div><div><div>var idList = ids.ToArray();</div><div>var query = context.Entities.GetQuery&lt;SomeEntity&gt;().Where(y =&gt; idList.Contains(y.Id));</div></div><div><br></div><div>I get serialization errors whethere I try this as a List&lt;T&gt; or array. Is there a workable way to search for all entities whose Id property is in a list?</div><div><br></div><div>I should mention that context.Entities is my strongly typed EntityManager and that I am doing this from Silverlight 4.</div><span style="font-size:10px"><br /><br />Edited by EisenbergEffect - 02-Sep-2010 at 11:28am</span>]]>
   </description>
   <pubDate>Fri, 20 Aug 2010 11:03:14 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2080&amp;PID=8118#8118</guid>
  </item> 
 </channel>
</rss>