<?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 : EntitySQL and include</title>
  <link>http://www.ideablade.com/forum/</link>
  <description>This is an XML content feed of; DevForce Community Forum : DevForce 2010 : EntitySQL and include</description>
  <pubDate>Thu, 15 Oct 2026 13:33:33 -700</pubDate>
  <lastBuildDate>Mon, 25 Jul 2011 15:06: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=2819</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>EntitySQL and include : That&amp;#039;s what I had observed...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11293#11293</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=275" rel="nofollow">danielp37</a><br /><strong>Subject:</strong> 2819<br /><strong>Posted:</strong> 25-Jul-2011 at 3:06pm<br /><br />That's what I had observed from my own testing but I was hoping that there was something I had overlooked.<div><br></div><div>Thanks,</div><div><br></div><div>Dan</div>]]>
   </description>
   <pubDate>Mon, 25 Jul 2011 15:06:38 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11293#11293</guid>
  </item> 
  <item>
   <title>EntitySQL and include : Dan,  Sorry, I misread your...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11292#11292</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1097" rel="nofollow">robertg</a><br /><strong>Subject:</strong> 2819<br /><strong>Posted:</strong> 25-Jul-2011 at 3:00pm<br /><br />Dan,<DIV>&nbsp;</DIV><DIV>Sorry, I misread your initial post. Otherwise, I wouldn't have flooded your inbox with examples that you clearly don't need; I apologize.</DIV><DIV>&nbsp;</DIV><DIV>No, I'm afraid there is not, since the PassthruEsqlQuery class requires the returntype in every overload, and would not know how to handle data returned in multiple types.</DIV><DIV>&nbsp;</DIV><DIV>Yours,</DIV><DIV>Robert</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV>]]>
   </description>
   <pubDate>Mon, 25 Jul 2011 15:00:42 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11292#11292</guid>
  </item> 
  <item>
   <title>EntitySQL and include : I&amp;#039;ve already got the query...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11291#11291</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=275" rel="nofollow">danielp37</a><br /><strong>Subject:</strong> 2819<br /><strong>Posted:</strong> 25-Jul-2011 at 2:49pm<br /><br />I've already got the query working in Entity SQL with parameters. &nbsp;My question is if there is a way to include other tables in the ParamaterizedEsqlQuery to eager load them rather than having to query for them individually after you get the entities back?<div><br></div><div>Dan</div>]]>
   </description>
   <pubDate>Mon, 25 Jul 2011 14:49:30 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11291#11291</guid>
  </item> 
  <item>
   <title>EntitySQL and include : If I understand correctly, you&amp;#039;re...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11290#11290</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1097" rel="nofollow">robertg</a><br /><strong>Subject:</strong> 2819<br /><strong>Posted:</strong> 25-Jul-2011 at 2:25pm<br /><br />If I understand correctly, you're allowing the end user to specify search criterion with wildcards, and then sending that directly to SQL in a command string or parameters? I don't believe that there's a way to accomplish this with LINQ in DevForce or EF. However, it may work if you use an Entity SQL query instead. For example, the following query against the NorthwindIB database should return one result: <DIV>&nbsp;</DIV><DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P></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>NorthwindIBEntities</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> manager = </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> </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>NorthwindIBEntities</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>();</P><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> query = </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> </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>PassthruEsqlQuery</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>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>),</P><BLOCKQUOTE style="MARGIN-RIGHT: 0px" dir=ltr><P></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>"SELECT VALUE E from Employees as E where E.FirstName like '%nd%w'"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>);</P></BLOCKQUOTE><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> result = query.With(manager).Execute().</FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>ToList();</P><DIV></FONT></FONT>Data validation and security is, of course, probably even more important with ESQL than with LINQ.&nbsp;As that's the case, you'll want to be sure to use this with a ParameterizedQuery. Here's how you do this:</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>string</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas> myQueryArgument = </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>"%ndr%w"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>;</DIV><DIV><P></FONT></FONT><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas><FONT color=#008000 size=2 face=C&#111;nsolas>// TODO: validation logic for customer input</P></FONT></FONT></FONT><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> myParameterizedquery = </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> </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>ParameterizedEsql</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>(</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>"SELECT VALUE E from Employees as E where E.FirstName like @name"</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>new</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>QueryParameter</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>(</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>"name"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>, myQueryArgument));</P><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> myQuery = </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> </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>PassthruEsqlQuery</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>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>), myParameterizedquery);</P><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> myResult = myQuery.With(manager).Execute().</FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>ToList();</P><DIV></FONT></FONT>&nbsp;</DIV><DIV>&nbsp;</DIV></DIV></DIV><span style="font-size:10px"><br /><br />Edited by robertg - 25-Jul-2011 at 2:28pm</span>]]>
   </description>
   <pubDate>Mon, 25 Jul 2011 14:25:37 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11290#11290</guid>
  </item> 
  <item>
   <title>EntitySQL and include : That won&amp;#039;t work because the...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11288#11288</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=275" rel="nofollow">danielp37</a><br /><strong>Subject:</strong> 2819<br /><strong>Posted:</strong> 25-Jul-2011 at 12:23pm<br /><br />That won't work because the user is able to choose where the '%' is placed and could actually place multiple '%'s in the search string thus I have to use ESQL to get the ability to fully use the like operator and with&nbsp;ESQL queries it doesn't allow you to use .includes so I was wondering if there is another way to include additional tables via ESQL.]]>
   </description>
   <pubDate>Mon, 25 Jul 2011 12:23:33 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11288#11288</guid>
  </item> 
  <item>
   <title>EntitySQL and include : If you&amp;#039;re using .include...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11287#11287</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=1097" rel="nofollow">robertg</a><br /><strong>Subject:</strong> 2819<br /><strong>Posted:</strong> 25-Jul-2011 at 11:55am<br /><br /><P>If you're using .include in your query, it should be eager-loading all of the related entities in the query that you're running. For your 'wildcard' operation, you can achieve the same thing by using a combination of StartsWith and EndsWith. For example, if you had the query 'select * from Address where Street like 'firstpart%lastpart', you could use:</P><DIV>&nbsp;</DIV><DIV><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas><P></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>List</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&lt;</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>Address</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>&gt; tests = manager.Addresses.ToList();</P><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> test = manager.Addresses</P><P>.Where(a =&gt; a.Street.ToLower().StartsWith(</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>"firstpart"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>))</P><P>.Where(a =&gt; a.Street.ToLower().EndsWith(</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>"lastpart"</FONT></FONT></FONT><FONT size=2 face=C&#111;nsolas><FONT size=2 face=C&#111;nsolas>))</P><P>.ToList();</P></FONT></FONT></DIV>]]>
   </description>
   <pubDate>Mon, 25 Jul 2011 11:55:21 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11287#11287</guid>
  </item> 
  <item>
   <title>EntitySQL and include : Is there a way toeager load additional...</title>
   <link>http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11221#11221</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://www.ideablade.com/forum/member_profile.asp?PF=275" rel="nofollow">danielp37</a><br /><strong>Subject:</strong> 2819<br /><strong>Posted:</strong> 12-Jul-2011 at 12:40pm<br /><br />Is there a way to&nbsp;eager load additional tables when querying via an Entity SQL query? &nbsp;The query isn't very complex but we are doing a search using the "like" operator and I haven't been able to find a way to do that in linq. &nbsp;I know that .StartsWith does a like 'Sometext%' but in this case the search needs to be able to put the '%' anywhere in the search string. &nbsp;There is one additional table that I want to bring in with the query results but haven't been able to figure out how to get Devforce to work with it. &nbsp;I found a way to do it in Entity SQL, but Devforce didn't like it as it appears that it only wants one entity returned per row but maybe I'm overlooking something.<div><br></div><div>Thank,</div><div><br></div><div>Dan Preece</div>]]>
   </description>
   <pubDate>Tue, 12 Jul 2011 12:40:09 -700</pubDate>
   <guid isPermaLink="true">http://www.ideablade.com/forum/forum_posts.asp?TID=2819&amp;PID=11221#11221</guid>
  </item> 
 </channel>
</rss>