<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title>Emad Ibrahim - Latest Comments in Dynamically Build LINQ Queries Using Reflection</title><link>http://emadibrahim.disqus.com/</link><description></description><atom:link href="https://emadibrahim.disqus.com/dynamically_build_linq_queries_using_reflection/latest.rss" rel="self"></atom:link><language>en</language><lastBuildDate>Wed, 14 Oct 2009 10:20:26 -0000</lastBuildDate><item><title>Re: Dynamically Build LINQ Queries Using Reflection</title><link>http://www.emadibrahim.com/2008/05/12/dynamically-build-linq-queries-using-reflection/#comment-20043662</link><description>&lt;p&gt;Honestly, it has been so long since I posted this and I can't remember but&lt;br&gt;if you do find, please come back and let us know.  It will help future&lt;br&gt;readers.&lt;br&gt;Thanks.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Emad</dc:creator><pubDate>Wed, 14 Oct 2009 10:20:26 -0000</pubDate></item><item><title>Re: Dynamically Build LINQ Queries Using Reflection</title><link>http://www.emadibrahim.com/2008/05/12/dynamically-build-linq-queries-using-reflection/#comment-19919535</link><description>&lt;p&gt;Nice article.  Quick question:  if i want to pass the results of the query which is in data access layer to business then to UI, what would be the return type?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">kashifpervaiz</dc:creator><pubDate>Mon, 12 Oct 2009 15:19:16 -0000</pubDate></item><item><title>Re: Dynamically Build LINQ Queries Using Reflection</title><link>http://www.emadibrahim.com/2008/05/12/dynamically-build-linq-queries-using-reflection/#comment-1601767</link><description>&lt;p&gt;@mark: Thanks for pointing out the Translate() method, I looked into it and that wouldn't solve my problem.  For starters using reflection works well for me because I can dynamically populate the list of columns in a checkboxlist and then dynamically create the LINQ query...&lt;/p&gt;&lt;p&gt;Using reflection and custom attribute also allowed me to specify which columns can be exported and which ones can't.  So that alone, would prevent me from using regular sql strings and executing on a command.&lt;/p&gt;&lt;p&gt;On the other hand, you are right, almost everything I did could have been done with a sql string and a command but where is the fun in that :)&lt;/p&gt;&lt;p&gt;Thanks for the string.Join...  I am embarrassed to say that I have never used it before and looking at your code snippet - I LOVE IT.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Emad Ibrahim</dc:creator><pubDate>Sat, 17 May 2008 07:49:32 -0000</pubDate></item><item><title>Re: Dynamically Build LINQ Queries Using Reflection</title><link>http://www.emadibrahim.com/2008/05/12/dynamically-build-linq-queries-using-reflection/#comment-1601766</link><description>&lt;p&gt;I see that you do not need a strongly typed result at all which'll also render DataContext.Translate() unnessesary. Why go through this hassle and not just execute a command directly?&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mark S. Rasmussen</dc:creator><pubDate>Thu, 15 May 2008 14:10:37 -0000</pubDate></item><item><title>Re: Dynamically Build LINQ Queries Using Reflection</title><link>http://www.emadibrahim.com/2008/05/12/dynamically-build-linq-queries-using-reflection/#comment-1601765</link><description>&lt;p&gt;I don't get it. How is this preferred over just doing a DataContext.Translate()?&lt;/p&gt;&lt;p&gt;Also, your dynamicClass string generation could be rewritten as a much simpler one-liner:&lt;br&gt;string dynamicClass = "new(" + string.Join(",", columnsToExport) + ")";&lt;/p&gt;&lt;p&gt;I'm assuming you validate for a positive number of selected columns somewhere else.&lt;/p&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">Mark S. Rasmussen</dc:creator><pubDate>Thu, 15 May 2008 14:03:59 -0000</pubDate></item></channel></rss>