<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Using Lambda Expressions with LINQ to SQL</title>
	<atom:link href="http://www.richardbushnell.net/2008/01/16/using-lambda-expressions-with-linq-to-sql/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.richardbushnell.net/2008/01/16/using-lambda-expressions-with-linq-to-sql/</link>
	<description></description>
	<lastBuildDate>Thu, 29 Sep 2011 17:23:04 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dan F</title>
		<link>http://www.richardbushnell.net/2008/01/16/using-lambda-expressions-with-linq-to-sql/comment-page-1/#comment-35</link>
		<dc:creator>Dan F</dc:creator>
		<pubDate>Wed, 25 Feb 2009 03:28:40 +0000</pubDate>
		<guid isPermaLink="false">http://richardbushnell.net/index.php/2008/01/16/using-lambda-expressions-with-linq-to-sql/#comment-35</guid>
		<description>Thanks for the explanation Richard. I googled the exception and you&#039;re pretty close to the top. You made me chortle with “You’re not using lambdas right, you dummy!” :-)

I&#039;m a vb coder, so if there&#039;s any people with similar disabilities, here&#039;s a vb translation of the expression&lt;func bit:

Dim doesClientExist As Expressions.Expression(Of Func(Of User, Boolean)) = _
            Function(user) _
                user.ID = ID

...

CreateUser(doesClientExist, ...)</description>
		<content:encoded><![CDATA[<p>Thanks for the explanation Richard. I googled the exception and you&#8217;re pretty close to the top. You made me chortle with “You’re not using lambdas right, you dummy!” <img src='http://www.richardbushnell.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>I&#8217;m a vb coder, so if there&#8217;s any people with similar disabilities, here&#8217;s a vb translation of the expression&lt;func bit:</p>
<p>Dim doesClientExist As Expressions.Expression(Of Func(Of User, Boolean)) = _<br />
            Function(user) _<br />
                user.ID = ID</p>
<p>&#8230;</p>
<p>CreateUser(doesClientExist, &#8230;)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rickard Nilsson</title>
		<link>http://www.richardbushnell.net/2008/01/16/using-lambda-expressions-with-linq-to-sql/comment-page-1/#comment-34</link>
		<dc:creator>Rickard Nilsson</dc:creator>
		<pubDate>Tue, 07 Oct 2008 18:48:04 +0000</pubDate>
		<guid isPermaLink="false">http://richardbushnell.net/index.php/2008/01/16/using-lambda-expressions-with-linq-to-sql/#comment-34</guid>
		<description>Forgot to attach the generic data context:

        private static System.Data.Linq.DataContext _context = null;
        protected static System.Data.Linq.DataContext context
        {
            get
            {
                if (_context == null) _context = new DataContext(con);
                return _context;
            }
        }</description>
		<content:encoded><![CDATA[<p>Forgot to attach the generic data context:</p>
<p>        private static System.Data.Linq.DataContext _context = null;<br />
        protected static System.Data.Linq.DataContext context<br />
        {<br />
            get<br />
            {<br />
                if (_context == null) _context = new DataContext(con);<br />
                return _context;<br />
            }<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rickard Nilsson</title>
		<link>http://www.richardbushnell.net/2008/01/16/using-lambda-expressions-with-linq-to-sql/comment-page-1/#comment-33</link>
		<dc:creator>Rickard Nilsson</dc:creator>
		<pubDate>Tue, 07 Oct 2008 18:45:27 +0000</pubDate>
		<guid isPermaLink="false">http://richardbushnell.net/index.php/2008/01/16/using-lambda-expressions-with-linq-to-sql/#comment-33</guid>
		<description>Thank you very much. You inspired me to write this:

        public static T find(Expression&lt;Func&gt; compare)
        {
            IQueryable result = context.GetTable(typeof(T)).AsQueryable().OfType().Where(compare);
            return result.First();
        }

So now I can write:


BusinessCase bc = BusinessCase.find(myCase =&gt; myCase.description2 == &quot;my desciption2&quot;);</description>
		<content:encoded><![CDATA[<p>Thank you very much. You inspired me to write this:</p>
<p>        public static T find(Expression&lt;Func&gt; compare)<br />
        {<br />
            IQueryable result = context.GetTable(typeof(T)).AsQueryable().OfType().Where(compare);<br />
            return result.First();<br />
        }</p>
<p>So now I can write:</p>
<p>BusinessCase bc = BusinessCase.find(myCase =&gt; myCase.description2 == &#8220;my desciption2&#8243;);</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andreas Hallberg</title>
		<link>http://www.richardbushnell.net/2008/01/16/using-lambda-expressions-with-linq-to-sql/comment-page-1/#comment-32</link>
		<dc:creator>Andreas Hallberg</dc:creator>
		<pubDate>Thu, 28 Aug 2008 08:51:57 +0000</pubDate>
		<guid isPermaLink="false">http://richardbushnell.net/index.php/2008/01/16/using-lambda-expressions-with-linq-to-sql/#comment-32</guid>
		<description>Thanks, nice explanation and it solved my problem.</description>
		<content:encoded><![CDATA[<p>Thanks, nice explanation and it solved my problem.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: NonGT</title>
		<link>http://www.richardbushnell.net/2008/01/16/using-lambda-expressions-with-linq-to-sql/comment-page-1/#comment-31</link>
		<dc:creator>NonGT</dc:creator>
		<pubDate>Wed, 20 Feb 2008 02:50:44 +0000</pubDate>
		<guid isPermaLink="false">http://richardbushnell.net/index.php/2008/01/16/using-lambda-expressions-with-linq-to-sql/#comment-31</guid>
		<description>Great topic! This give me the light,
thank you so much.</description>
		<content:encoded><![CDATA[<p>Great topic! This give me the light,<br />
thank you so much.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

