<?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 : EntityQuery, with &quot;dynamic&quot; where clause</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : EntityQuery, with &quot;dynamic&quot; where clause</description>
  <pubDate>Sun, 26 Apr 2026 22:46:45 -700</pubDate>
  <lastBuildDate>Fri, 27 May 2011 14:04:44 -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=2725</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>EntityQuery, with &quot;dynamic&quot; where clause : Well, thank you for just saving...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2725&amp;PID=10856#10856</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1151" rel="nofollow">Randar</a><br /><strong>Subject:</strong> 2725<br /><strong>Posted:</strong> 27-May-2011 at 2:04pm<br /><br />Well, thank you for just saving me hours of banging my head against the wall.<br><br>Worked perfectly, after I ported it over to VB.Net. ;-)<br>]]>
   </description>
   <pubDate>Fri, 27 May 2011 14:04:44 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2725&amp;PID=10856#10856</guid>
  </item> 
  <item>
   <title>EntityQuery, with &quot;dynamic&quot; where clause : In case anybody is wondering what...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2725&amp;PID=10855#10855</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=892" rel="nofollow">sbelini</a><br /><strong>Subject:</strong> 2725<br /><strong>Posted:</strong> 27-May-2011 at 1:17pm<br /><br /><DIV>In case anybody is wondering what a possible solution would look like:</DIV><DIV>&nbsp;</DIV><DIV></DIV><DIV></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>&nbsp; var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> queriedID = 1;</FONT></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>&nbsp; var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> queryType = </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>typeof</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>Employee</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</FONT></FONT></DIV><DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&nbsp;</DIV><DIV><DIV></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></FONT></FONT></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>&nbsp; var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> baseQuery = </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>.Create(queryType, mgr);</DIV><DIV></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>&nbsp; var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> properties = queryType.GetProperties();</DIV><DIV></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>&nbsp; IEnumerable</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> result;</DIV><DIV></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>&nbsp; if</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> (properties.Any(p =&gt; p.Name == </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>"CompanyID"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>)) {</DIV><DIV></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>&nbsp;&nbsp;&nbsp; PredicateDescription</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> predicate = </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>PredicateBuilder</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>.Make(queryType, </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>"CompanyID"</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>FilterOperator</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>.IsEqualTo, queriedID);</DIV><DIV></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>&nbsp;&nbsp;&nbsp; var</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> query = baseQuery.Where(predicate);</DIV><DIV>&nbsp;&nbsp;&nbsp; result = query.Execute();</DIV><DIV>&nbsp; }</DIV></FONT></FONT></DIV><DIV></DIV><DIV></DIV><DIV>&nbsp;</DIV><DIV>Detailed information about dynamic queries is available in the <a href="http://drc.ideablade.com/xwiki/bin/view/&#068;ocumentati&#111;n/dynamic-queries" target="_blank">DevForce Resource Center</A>.</DIV><DIV></DIV><DIV></DIV><DIV>&nbsp;</DIV><DIV>Silvio.</DIV>]]>
   </description>
   <pubDate>Fri, 27 May 2011 13:17:29 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2725&amp;PID=10855#10855</guid>
  </item> 
  <item>
   <title>EntityQuery, with &quot;dynamic&quot; where clause : Hi Randar -I saw you talked with...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2725&amp;PID=10854#10854</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> 2725<br /><strong>Posted:</strong> 27-May-2011 at 12:13pm<br /><br />Hi Randar -&nbsp;I saw you talked with Albert on the phone about this. Let us know if you need any more help with it.<div><br></div>]]>
   </description>
   <pubDate>Fri, 27 May 2011 12:13:03 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2725&amp;PID=10854#10854</guid>
  </item> 
  <item>
   <title>EntityQuery, with &quot;dynamic&quot; where clause : I&amp;#039;ve got some code I&amp;#039;m...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2725&amp;PID=10850#10850</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1151" rel="nofollow">Randar</a><br /><strong>Subject:</strong> 2725<br /><strong>Posted:</strong> 27-May-2011 at 8:40am<br /><br />I've got some code I'm trying to port over.&nbsp; A key part of it generates some dynamic sql like so:<br><br>strSQL = "Select * From " &amp; SqlTableName &amp; " Where CompanyID=" &amp; CompanyID<br><br>I'm trying to figure out the best way to map this to an EntityQuery(Of T).&nbsp; What I would like to do is:<br>1) Check if T has a specific property, called CompanyId.&nbsp; This *should* be possible through reflection.<br>2) Once I've verified that this property exists, extend the EntityQuery to include this in the Where clause.&nbsp; That, I'm not so sure how to do.<br><br>My current thinking is either:<br>a) Expose an interface on the underlying Entity called ICompany, that exposes the CompanyId.&nbsp; I think I *should* be able to build predicate up once I have that and then attach that to the Where clause.<br>b) Give up...and change all the calling methods to include the company filter.&nbsp; <br><br>Any thoughts?<br>]]>
   </description>
   <pubDate>Fri, 27 May 2011 08:40:37 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2725&amp;PID=10850#10850</guid>
  </item> 
 </channel>
</rss>