<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:ymaps="http://api.maps.yahoo.com/Maps/V2/AnnotatedMaps.xsd">

<channel>
	<title>Dylan Baxter</title>
	<atom:link href="http://dylanbaxter.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://dylanbaxter.com</link>
	<description>Just another WordPress site</description>
	<lastBuildDate>Wed, 25 Jan 2012 05:09:36 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Using Contains() in LINQ-to-Entities</title>
		<link>http://dylanbaxter.com/2010/12/using-contains-in-linq-to-entities/</link>
		<comments>http://dylanbaxter.com/2010/12/using-contains-in-linq-to-entities/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 06:06:43 +0000</pubDate>
		<dc:creator>dylan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[LINQ]]></category>

		<guid isPermaLink="false">http://dylanbaxter.com/?p=10</guid>
		<description><![CDATA[Before I forget, for the sake of my own posterity and to test the syntax highlighter plugin I just installed, I would like to take a moment to remind anyone who reads this of a sizable caveat using the Contains() &#8230; <a href="http://dylanbaxter.com/2010/12/using-contains-in-linq-to-entities/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Before I forget, for the sake of my own posterity and to test the syntax highlighter plugin I just installed, I would like to take a moment to remind anyone who reads this of a sizable caveat using the Contains() extension method with Entity Framework version 1. Crucially, the method does not generate correct SQL and so the developer was forced to write a compare expression.<br />
Here is that Expression:</p>
<pre class="brush: csharp; title: ;">
static Expression&lt;Func&lt;TElement, bool&gt;&gt; BuildContainsExpression&lt;TElement, TValue&gt;(
    Expression&lt;Func&lt;TElement, TValue&gt;&gt; valueSelector, IEnumerable&lt;TValue&gt; values)
{
    if (null == valueSelector) { throw new ArgumentNullException(&quot;valueSelector&quot;); }
    if (null == values) { throw new ArgumentNullException(&quot;values&quot;); }

    ParameterExpression p = valueSelector.Parameters.Single();

    // p =&gt; valueSelector(p) == values[0] || valueSelector(p) == ...

    if (!values.Any())
    {
        return e =&gt; false;
    }

    var equals = values.Select(value =&gt; (Expression)Expression.Equal(valueSelector.Body,
		Expression.Constant(value, typeof(TValue))));
    var body = equals.Aggregate&lt;Expression&gt;((accumulate, equal) =&gt; Expression.Or(accumulate, equal));
    return Expression.Lambda&lt;Func&lt;TElement, bool&gt;&gt;(body, p);
}
</pre>
<p>Usage is similar to the following:</p>
<pre class="brush: csharp; title: ;">
var assignees = _entities.Admin_Users.Where(BuildContainsExpression&lt;Admin_Users, int&gt;(e =&gt; e.Admin_Department_ID.Value,
                departmentsToReturn));
</pre>
]]></content:encoded>
			<wfw:commentRss>http://dylanbaxter.com/2010/12/using-contains-in-linq-to-entities/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bottom of Combi trail, Angle Fire, New Mexico</title>
		<link>http://dylanbaxter.com/2010/12/bottom-of-combi-trail-angle-fire-new-mexico/</link>
		<comments>http://dylanbaxter.com/2010/12/bottom-of-combi-trail-angle-fire-new-mexico/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 05:24:05 +0000</pubDate>
		<dc:creator>dylan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Church of the Fat Tire]]></category>

		<guid isPermaLink="false">http://dylanbaxter.com/?p=8</guid>
		<description><![CDATA[]]></description>
			<content:encoded><![CDATA[<p><object width="584" height="463"><param name="movie" value="http://www.youtube.com/v/-lSZbYSpGwM?version=3"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/-lSZbYSpGwM?version=3" type="application/x-shockwave-flash" width="584" height="463" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://dylanbaxter.com/2010/12/bottom-of-combi-trail-angle-fire-new-mexico/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Here we go again&#8230;old platform, new version.</title>
		<link>http://dylanbaxter.com/2010/12/here-we-go-again-old-platform-new-version/</link>
		<comments>http://dylanbaxter.com/2010/12/here-we-go-again-old-platform-new-version/#comments</comments>
		<pubDate>Sat, 11 Dec 2010 02:15:35 +0000</pubDate>
		<dc:creator>dylan</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://dylanbaxter.com/?p=4</guid>
		<description><![CDATA[Web hosting can be both expensive and time-consuming, especially when you are running your own server. So in order to free up some time, hit the reset button on some stagnant projects and generally simplify my life I came back &#8230; <a href="http://dylanbaxter.com/2010/12/here-we-go-again-old-platform-new-version/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
			<content:encoded><![CDATA[<p>Web hosting can be both expensive and time-consuming, especially when you are running your own server. So in order to free up some time, hit the reset button on some stagnant projects and generally simplify my life I came back to good old Dreamhost. I also came back to WordPress because of some new features, like remote publishing and a cleaner administrative interface.<br />
And with this obligatory first post out of the way, all of my readers can get back to not existing and I can get back to not publishing any content!</p>
]]></content:encoded>
			<wfw:commentRss>http://dylanbaxter.com/2010/12/here-we-go-again-old-platform-new-version/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

