<?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 : Dynamic Query from two predicates.</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : Dynamic Query from two predicates.</description>
  <pubDate>Thu, 15 Oct 2026 14:07:58 -700</pubDate>
  <lastBuildDate>Mon, 27 Jun 2011 16:00:38 -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=2758</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>Dynamic Query from two predicates. : Hi pk55;The patch that I&amp;#039;m...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=11129#11129</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> 2758<br /><strong>Posted:</strong> 27-Jun-2011 at 4:00pm<br /><br />Hi pk55;<div><br></div><div>The patch that I'm sending you will contain this fix as well.</div>]]>
   </description>
   <pubDate>Mon, 27 Jun 2011 16:00:38 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=11129#11129</guid>
  </item> 
  <item>
   <title>Dynamic Query from two predicates. : Any idea when this would be fixed...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=11128#11128</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> 2758<br /><strong>Posted:</strong> 27-Jun-2011 at 3:57pm<br /><br /><P>Any idea when this would be fixed to allow a composite?</P>]]>
   </description>
   <pubDate>Mon, 27 Jun 2011 15:57:10 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=11128#11128</guid>
  </item> 
  <item>
   <title>Dynamic Query from two predicates. :   The problem with the CompositionPredicateDescription...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=11121#11121</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> 2758<br /><strong>Posted:</strong> 27-Jun-2011 at 1:08pm<br /><br />The problem with the CompositionPredicateDescription when used with FilterOperator.Any is actually a bug.&nbsp; The intention with our dynamic query API has been to provide support for common LINQ methods.&nbsp; The Queryable.Any LINQ method, which FilterOperator.Any is trying to proxy, supports either no arguments or a single predicate, and we&nbsp;translated that "predicate" a bit too strictly.&nbsp;&nbsp; ]]>
   </description>
   <pubDate>Mon, 27 Jun 2011 13:08:20 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=11121#11121</guid>
  </item> 
  <item>
   <title>Dynamic Query from two predicates. : Is the requirement that the ANY...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=11107#11107</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> 2758<br /><strong>Posted:</strong> 25-Jun-2011 at 2:11pm<br /><br />Is the requirement that the ANY filter operator&nbsp;only have one, single predicate description a bug or is that by design?&nbsp; <DIV>&nbsp;</DIV><DIV>Seems kind of limited if you can't filter a child collection on more than one property and then filter the parent based on it having a child that matches that condition.</DIV>]]>
   </description>
   <pubDate>Sat, 25 Jun 2011 14:11:43 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=11107#11107</guid>
  </item> 
  <item>
   <title>Dynamic Query from two predicates. : Thank you - that works!One remark...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=10974#10974</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=857" rel="nofollow">sarmaad</a><br /><strong>Subject:</strong> 2758<br /><strong>Posted:</strong> 14-Jun-2011 at 3:11am<br /><br />Thank you - that works!<div><br></div><div>One remark -&nbsp;<span ="Apple-style-span" style="-webkit-border-horiz&#111;ntal-spacing: 1px; -webkit-border-vertical-spacing: 1px; ">pd1 cannot be a CompositePredicateDescription, it generates exception otherwise.</span></div>]]>
   </description>
   <pubDate>Tue, 14 Jun 2011 03:11:50 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=10974#10974</guid>
  </item> 
  <item>
   <title>Dynamic Query from two predicates. :   That is an ugly exception....</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=10967#10967</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> 2758<br /><strong>Posted:</strong> 13-Jun-2011 at 2:52pm<br /><br />That is an ugly exception.&nbsp; It looks like we have a problem with the use of the nested Queryable.Any() inside of the predicate, but it's going to take more research to determine the underlying problem and how we might fix it.<div>&nbsp;</div><div>For now, if you're able to use PredicateDescriptions for both clauses, you can do something like the following:</div><div>&nbsp;</div><div>var baseQuery = EntityQuery&lt;Contact&gt;.Create(typeof(Contact), Manager);<br>var pd1 = new PredicateDescription(typeof(CompanyContacts), "Company.CompanyName", FilterOperator.Contains, "some_name");<br>var pd2 = new PredicateDescription(typeof(Contact), "CompanyContacts", FilterOperator.Any, pd1);<br>var query = baseQuery.Where(pd2).OrderBySelector(selector).Skip(skip).Take(take);</div><div>&nbsp;</div>]]>
   </description>
   <pubDate>Mon, 13 Jun 2011 14:52:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=10967#10967</guid>
  </item> 
  <item>
   <title>Dynamic Query from two predicates. : I have got a following query:E...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=10947#10947</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=857" rel="nofollow">sarmaad</a><br /><strong>Subject:</strong> 2758<br /><strong>Posted:</strong> 13-Jun-2011 at 5:48am<br /><br /><div>I have got a following query:</div><div><br></div><div><font ="Apple-style-span" face="'Courier New', Courier, mono"><font ="Apple-style-span" color="#66CCFF">Expression</font>&lt;<font ="Apple-style-span" color="#66CCFF">Func</font>&lt;<font ="Apple-style-span" color="#66CCFF">Contact, </font><font ="Apple-style-span" color="#3366FF">bool</font>&gt;&gt; c2 = (col =&gt; col.CompanyContacts.AsQueryable().Any(p =&gt; p.Company.CompanyName.Contains("some_name")));</font></div><div><font ="Apple-style-span" face="'Courier New', Courier, mono"><br></font></div><div><font ="Apple-style-span" face="'Courier New', Courier, mono"><font ="Apple-style-span" color="#66CCFF">ITypedEntityQuery</font> query = <font ="Apple-style-span" color="#66CCFF">EntityQuery</font>&lt;<font ="Apple-style-span" color="#66CCFF">Contact</font>&gt;.Create(<font ="Apple-style-span" color="#0066FF">typeof</font>(<font ="Apple-style-span" color="#66CCFF">Contact</font>), Manager).Cast&lt;<font ="Apple-style-span" color="#66CCFF">Contact</font>&gt;().Where(c2).OrderBySelector(selector).Skip(skip).Take(take);</font></div><div><br></div><div>That works perfectly fine. Unfortunatelly when I try to split the first expression into two like this:</div><div><br></div><div><font ="Apple-style-span" face="'Courier New', Courier, mono">var exp1 = (Expression&lt;Func&lt;CompanyContact, bool&gt;&gt;)(p =&gt; p.Company.CompanyName.Contains("some_name"));</font></div><div><font ="Apple-style-span" face="'Courier New', Courier, mono">Expression&lt;Func&lt;Contact, bool&gt;&gt; c2 = (col =&gt; col.CompanyContacts.AsQueryable().Any(exp1));</font></div><div><br></div><div>I got a nasty serialization error:</div><div><br></div><div><font ="Apple-style-span" face="'Courier New', Courier, mono">Type 'System.Linq.Expressions.Expression`1&#091;System.Func`2&#091;DomainModel.CompanyContact,System.Boolean&#093;&#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.</font></div><div><br></div><div>The point of splitting the query is simple - I want to generate the inner part from IPredicateDescription.</div><div><br></div><div>Thanks in advance.</div>]]>
   </description>
   <pubDate>Mon, 13 Jun 2011 05:48:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2758&amp;PID=10947#10947</guid>
  </item> 
 </channel>
</rss>