<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>mhinze.com</title>
	
	<link>http://mhinze.com</link>
	<description>Matt Hinze's web log</description>
	<lastBuildDate>Tue, 07 Jul 2009 01:20:30 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/mhinzecom" type="application/rss+xml" /><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.bloglines.com/sub/http://feeds.feedburner.com/mhinzecom" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2Fmhinzecom" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>AutoMapper in NerdDinner</title>
		<link>http://mhinze.com/automapper-in-nerddinner/</link>
		<comments>http://mhinze.com/automapper-in-nerddinner/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 11:00:00 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Tools]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[automapper]]></category>

		<guid isPermaLink="false">http://mhinze.com/automapper-in-nerddinner/</guid>
		<description><![CDATA[
Speaking of NerdDinner, Scott asked me to use it to create an AutoMapper example.  
AutoMapper, the brainchild of Jimmy Bogard, is an object-to-object mapper.&#160; What that means is up to you &#8211; but we&#039;ll use it here to map from the domain model to a view model.&#160; The view model is an object heirarchy [...]]]></description>
			<content:encoded><![CDATA[</p>
<p><a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/07/03/how-not-to-do-dependency-injection-in-nerddinner.aspx">Speaking</a> of <a href="http://nerddinner.codeplex.com/">NerdDinner</a>, <a href="http://www.hanselman.com/blog/">Scott</a> <a href="http://twitter.com/shanselman/status/2441262483">asked me</a> to use it to create an <a href="http://code.google.com/p/automapperhome/">AutoMapper</a> example. <a href="http://mhinze.com/wp-content/uploads/2009/07/logo.png"><img title="logo" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; margin: 0px 0px 15px 20px; border-right-width: 0px" height="90" alt="logo" src="http://mhinze.com/wp-content/uploads/2009/07/logo_thumb.png" width="244" align="right" border="0" /></a> </p>
<p>AutoMapper, the brainchild of <a href="http://www.lostechies.com/blogs/jimmy_bogard/default.aspx">Jimmy Bogard</a>, is an object-to-object mapper.&#160; What that means is up to you &#8211; but we&#039;ll use it here to map from the domain model to a view model.&#160; The view model is an object heirarchy that represents the screen.&#160; It&#039;s as dumb as possible, just like the view.</p>
<p>We get a lot of nice things out of it and it helps us go faster.&#160; You can read more about it AutoMapper from <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/tags/AutoMapper/default.aspx">Jimmy</a> or at the website on <a href="http://www.codeplex.com/AutoMapper">Codeplex</a>.</p>
<p>For starters, NerdDinner isn&#039;t the best scenario in which to apply AutoMapper.&#160; NerdDinner is very small so there&#039;s not much reuse to harvest. For example, if you format dates the same way a million times you can use AutoMapper to only write that formatting code once.&#160; In a small application you may format dates two ways and only use the resulting text in two views.&#160; It doesn&#039;t make a lot of sense to extract a class just for that &#8211; it will seem like a lot of overhead.&#160; </p>
<p>Also NerdDinner doesn&#039;t have a rich domain model &#8211; there&#039;s just not that much to do.&#160; So the AutoMapper feature of <a href="http://automapper.codeplex.com/Wiki/View.aspx?title=Flattening">flattening complex hierarchies</a> can&#039;t be appreciated. </p>
<p>I posted <a href="http://mhinze.com/static-content/nerddinner-23425-automapper.zip"><strong>the result of this quick and dirty spike</strong></a> as a sample project &#8211; hopefully this will help you get started looking at it.</p>
<p>First, I copypasted a class to bootstrap AutoMapper:</p>
<pre class="code"><span style="color: blue">namespace </span>NerdDinner.Helpers.AutoMapper
{
    <span style="color: blue">public class </span><span style="color: #2b91af">AutoMapperConfiguration
    </span>{
        <span style="color: blue">public static void </span>Configure()
        {
            <span style="color: #2b91af">Mapper</span>.Initialize(x =&gt; x.AddProfile&lt;<span style="color: #2b91af">ViewModelProfile</span>&gt;());
        }
    }
}</pre>
<p>.. which will be called when the application starts:</p>
<pre class="code"><span style="color: blue">void </span>Application_Start()
{
    <span style="color: #2b91af">AutoMapperConfiguration</span>.Configure();

    RegisterRoutes(<span style="color: #2b91af">RouteTable</span>.Routes);

    <span style="color: #2b91af">ViewEngines</span>.Engines.Clear();
    <span style="color: #2b91af">ViewEngines</span>.Engines.Add(<span style="color: blue">new </span><span style="color: #2b91af">MobileCapableWebFormViewEngine</span>());
}</pre>
<p>I copypasted another class that will check the mapping configuration for errors, providing fast feedback should I make a mistake. </p>
<pre class="code">[<span style="color: #2b91af">TestClass</span>]
<span style="color: blue">public class </span><span style="color: #2b91af">AutoMapperConfigurationTester
</span>{
    [<span style="color: #2b91af">TestMethod</span>]
    <span style="color: blue">public void </span>Should_map_dtos()
    {
        <span style="color: #2b91af">AutoMapperConfiguration</span>.Configure();
        <span style="color: #2b91af">Mapper</span>.AssertConfigurationIsValid();
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>Now I&#039;m ready to begin creating the view model and configuring AutoMapper. </p>
<p>To design a view model, start with the screen.&#160; What&#039;s displayed will be represented in the model.&#160; Again: the view model is an object hierarchy that represents the user interface.&#160; I picked the Dinner Details screen, by the way. </p>
<p>The current model being used by the view was the Dinner entity itself.&#160; There was a lot of formatting in the view and a lot of duplication.</p>
<p>Almost every property was surrounded by code that would HtmlEncode it (it will be nice to have AutoMapper do this for us):</p>
<pre class="code"><span style="background: #ffee62">&lt;%</span><span style="color: blue">= </span>Html.Encode(Model.Title) <span style="background: #ffee62">%&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>And there is a lot of formatting to do:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">abbr </span><span style="color: red">class</span><span style="color: blue">=&quot;dtstart&quot; </span><span style="color: red">title</span><span style="color: blue">=&quot;</span><span style="background: #ffee62">&lt;%</span>= Model.EventDate.ToString(&quot;s&quot;) <span style="background: #ffee62">%&gt;</span><span style="color: blue">&quot;&gt;
    </span><span style="background: #ffee62">&lt;%</span><span style="color: blue">= </span>Model.EventDate.ToString(<span style="color: #a31515">&quot;MMM dd, yyyy&quot;</span>) <span style="background: #ffee62">%&gt;</span>
    <span style="color: blue">&lt;</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;</span>@<span style="color: blue">&lt;/</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;
    </span><span style="background: #ffee62">&lt;%</span><span style="color: blue">= </span>Model.EventDate.ToShortTimeString() <span style="background: #ffee62">%&gt;
</span><span style="color: blue">&lt;/</span><span style="color: #a31515">abbr</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>Imagine a project with 300 screens and a team of analysts and you can imagine that specifying this formatting over and over again in requirements documents and planning would become tedious.&#160; Not to mention coding it.&#160; It&#039;d be easier to just say: &#034;Format this date in the standard way.&#034; You can also imagine the security implications of forgetting to encode even one value.</p>
<p>In converting these screens to use a view model instead of the domain model I didn&#039;t want to change existing functionality.&#160; So I took this:</p>
<pre class="code"><span style="background: #ffee62">&lt;%</span><span style="color: blue">@ </span><span style="color: #a31515">Page </span><span style="color: red">Language</span><span style="color: blue">=&quot;C#&quot; </span><span style="color: red">Inherits</span><span style="color: blue">=&quot;System.Web.Mvc.ViewPage&lt;NerdDinner.Models.Dinner&gt;&quot;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>and changed it to this:</p>
<pre class="code"><span style="background: #ffee62">&lt;%</span><span style="color: blue">@ </span><span style="color: #a31515">Page </span><span style="color: red">Language</span><span style="color: blue">=&quot;C#&quot; </span><span style="color: red">Inherits</span><span style="color: blue">=&quot;System.Web.Mvc.ViewPage&lt;DinnerDetailsViewModel&gt;&quot;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>See what I did there?&#160; I just changed the type of the Model property to a new DinnerDetailsViewModel type.</p>
<p>The view will receive a view model mapped from the domain model when I apply a special action filter to the controller action:</p>
<pre class="code">[<span style="color: #2b91af">AutoMap</span>(<span style="color: blue">typeof</span>(<span style="color: #2b91af">Dinner</span>), <span style="color: blue">typeof</span>(<span style="color: #2b91af">DinnerDetailsViewModel</span>))]</pre>
<p>The code&#039;s in the sample, straight from <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/06/29/how-we-do-mvc-view-models.aspx">Jimmy&#039;s post</a>.</p>
<p>I started out with DinnerDetailsViewModel being an empty class definition and used Resharper to generate each property as I encountered it.&#160; I removed the formatting and the ubiquitous encoding from the parameters, turning this:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">div </span><span style="color: red">id</span><span style="color: blue">=&quot;dinnerDiv&quot; </span><span style="color: red">class</span><span style="color: blue">=&quot;vevent&quot;&gt;

    &lt;</span><span style="color: #a31515">h2 </span><span style="color: red">class</span><span style="color: blue">=&quot;summary&quot;&gt;</span><span style="background: #ffee62">&lt;%</span><span style="color: blue">= </span>Html.Encode(Model.Title) <span style="background: #ffee62">%&gt;</span><span style="color: blue">&lt;/</span><span style="color: #a31515">h2</span><span style="color: blue">&gt;

    &lt;</span><span style="color: #a31515">p</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">a </span><span style="color: red">href</span><span style="color: blue">=&quot;http://feeds.technorati.com/events/</span><span style="background: #ffee62">&lt;%</span>= Url.AbsoluteAction(&quot;Details&quot;, new { id = Model.DinnerID }) <span style="background: #ffee62">%&gt;</span><span style="color: blue">&quot;&gt;
            </span>Add event to your calendar (iCal)
        <span style="color: blue">&lt;/</span><span style="color: #a31515">a</span><span style="color: blue">&gt;
    &lt;/</span><span style="color: #a31515">p</span><span style="color: blue">&gt;

    &lt;</span><span style="color: #a31515">p</span><span style="color: blue">&gt;
        &lt;</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;</span>When:<span style="color: blue">&lt;/</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;
&lt;</span><span style="color: #a31515">abbr </span><span style="color: red">class</span><span style="color: blue">=&quot;dtstart&quot; </span><span style="color: red">title</span><span style="color: blue">=&quot;</span><span style="background: #ffee62">&lt;%</span>= Model.EventDate.ToString(&quot;s&quot;) <span style="background: #ffee62">%&gt;</span><span style="color: blue">&quot;&gt;
</span><span style="background: #ffee62">&lt;%</span><span style="color: blue">= </span>Model.EventDate.ToString(<span style="color: #a31515">&quot;MMM dd, yyyy&quot;</span>) <span style="background: #ffee62">%&gt;</span>
<span style="color: blue">&lt;</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;</span>@<span style="color: blue">&lt;/</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;
</span><span style="background: #ffee62">&lt;%</span><span style="color: blue">= </span>Model.EventDate.ToShortTimeString() <span style="background: #ffee62">%&gt;
</span><span style="color: blue">&lt;/</span><span style="color: #a31515">abbr</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>into this:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">h2 </span><span style="color: red">class</span><span style="color: blue">=&quot;summary&quot;&gt;</span><span style="background: #ffee62">&lt;%</span><span style="color: blue">= </span>Model.Title <span style="background: #ffee62">%&gt;</span><span style="color: blue">&lt;/</span><span style="color: #a31515">h2</span><span style="color: blue">&gt;

&lt;</span><span style="color: #a31515">p</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">a </span><span style="color: red">href</span><span style="color: blue">=&quot;http://feeds.technorati.com/events/</span><span style="background: #ffee62">&lt;%</span>= Url.AbsoluteAction(&quot;Details&quot;, new { id = Model.DinnerID }) <span style="background: #ffee62">%&gt;</span><span style="color: blue">&quot;&gt;
        </span>Add event to your calendar (iCal)
    <span style="color: blue">&lt;/</span><span style="color: #a31515">a</span><span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">p</span><span style="color: blue">&gt;

&lt;</span><span style="color: #a31515">p</span><span style="color: blue">&gt;
    &lt;</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;</span>When:<span style="color: blue">&lt;/</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;
    </span><span style="background: #ffee62">&lt;%</span><span style="color: blue">= </span>Model.EventDate <span style="background: #ffee62">%&gt;
</span><span style="color: blue">&lt;/</span><span style="color: #a31515">p</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><a href="http://11011.net/software/vspaste"></a>I had to write a formatter to replace the custom formatting performed by the view. </p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">AttendeeNameFormatter </span>: <span style="color: #2b91af">BaseFormatter</span>&lt;<span style="color: blue">string</span>&gt;
{
    <span style="color: blue">protected override string </span>FormatValueCore(<span style="color: blue">string </span>value)
    {
        <span style="color: blue">return </span>value.Replace(<span style="color: #a31515">&quot;@&quot;</span>, <span style="color: #a31515">&quot; at &quot;</span>);
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><a href="http://11011.net/software/vspaste"></a>See how testable that is; small and reusable?</p>
<p><a href="http://11011.net/software/vspaste"></a>I also moved some methods that were previously being called from the view directly into the domain model which AutoMapper will evaluate at runtime. </p>
<p>Before:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">p </span><span style="color: red">id</span><span style="color: blue">=&quot;whoscoming&quot;&gt;
    &lt;</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;</span>Who's Coming:<span style="color: blue">&lt;/</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;
    </span><span style="background: #ffee62">&lt;%</span><span style="color: blue">if </span>(Model.RSVPs.Count == 0){<span style="background: #ffee62">%&gt;
</span>          No one has registered.
    <span style="background: #ffee62">&lt;%</span> } <span style="background: #ffee62">%&gt;
</span><span style="color: blue">&lt;/</span><span style="color: #a31515">p</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>After:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">p </span><span style="color: red">id</span><span style="color: blue">=&quot;whoscoming&quot;&gt;
    &lt;</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;</span>Who's Coming:<span style="color: blue">&lt;/</span><span style="color: #a31515">strong</span><span style="color: blue">&gt;
    </span><span style="background: #ffee62">&lt;%</span><span style="color: blue">if </span>(Model.IsNobodyRegistered){<span style="background: #ffee62">%&gt;
</span>          No one has registered.
    <span style="background: #ffee62">&lt;%</span> } <span style="background: #ffee62">%&gt;
</span><span style="color: blue">&lt;/</span><span style="color: #a31515">p</span><span style="color: blue">&gt;</span></pre>
<p>The view model for this screen ends up looking like this:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">DinnerDetailsViewModel
</span>{
    <span style="color: blue">public string </span>Address { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public string </span>Title { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public string </span>DinnerID { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public string </span>EventDate { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public string </span>Country { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public string </span>Latitude { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public string </span>Longitude { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public string </span>Description { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public string </span>HostedBy { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public string </span>ContactPhone { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public bool </span>IsAnyoneRegistered { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public bool </span>IsNobodyRegistered { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public bool </span>IsCurrentUserRegistered { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    <span style="color: blue">public bool </span>IsCurrentUserHosting { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }

    <span style="color: blue">public </span><span style="color: #2b91af">List</span>&lt;<span style="color: #2b91af">RsvpViewModel</span>&gt; RSVPs { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }

    <span style="color: blue">public class </span><span style="color: #2b91af">RsvpViewModel
    </span>{
        <span style="color: blue">public string </span>AttendeeName { <span style="color: blue">get</span>; <span style="color: blue">set</span>; }
    }
}</pre>
<p>The really key part is the AutoMapper configuration profile.&#160; You can group configurations with profiles.&#160; Maybe in one profile you format dates in one way, in another profile you format dates in another way.&#160; I&#039;m just using one profile here.</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">ViewModelProfile </span>: <span style="color: #2b91af">Profile
</span>{
    <span style="color: blue">protected override string </span>ProfileName
    {
        <span style="color: blue">get </span>{ <span style="color: blue">return </span><span style="color: #a31515">&quot;ViewModel&quot;</span>; }
    }

    <span style="color: blue">protected override void </span>Configure()
    {
        AddFormatter&lt;<span style="color: #2b91af">HtmlEncoderFormatter</span>&gt;();
        ForSourceType&lt;<span style="color: #2b91af">DateTime</span>&gt;().AddFormatter&lt;<span style="color: #2b91af">StandardDateFormatter</span>&gt;();

        CreateMap&lt;<span style="color: #2b91af">Dinner</span>, <span style="color: #2b91af">DinnerDetailsViewModel</span>&gt;()
            .ForMember(x =&gt; x.IsCurrentUserRegistered, o =&gt; o.ResolveUsing&lt;<span style="color: #2b91af">CurrentUserRegisteredResolver</span>&gt;())
            .ForMember(x =&gt; x.IsCurrentUserHosting, o =&gt; o.ResolveUsing&lt;<span style="color: #2b91af">CurrentUserHostingResolver</span>&gt;())
            .ForMember(x =&gt; x.EventDate, o =&gt; o.SkipFormatter&lt;<span style="color: #2b91af">HtmlEncoderFormatter</span>&gt;());

        CreateMap&lt;<span style="color: #2b91af">RSVP</span>, <span style="color: #2b91af">DinnerDetailsViewModel</span>.<span style="color: #2b91af">RsvpViewModel</span>&gt;()
            .ForMember(x =&gt; x.AttendeeName, o =&gt; o.AddFormatter&lt;<span style="color: #2b91af">AttendeeNameFormatter</span>&gt;());
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><a href="http://11011.net/software/vspaste"></a>Most properties of the view model are mapped conventionally.&#160; The property names match up so AutoMapper knows exactly what do do with them.&#160; AutoMapper will do a lot more for you if you&#039;d like it to.&#160; This is actually a pretty hefty configuration.&#160; In a different scenario it&#039;d be likely that almost everything is mapped conventionally.</p>
<p>Note the first AddFormatter call.&#160; That&#039;s instructing AutoMapper to html encode everything.&#160; I skip it for a property later.&#160; The possibilities here are endless.&#160; One cool thing we do <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/04/24/how-we-do-mvc.aspx">in another project</a> is wrap each property in a span that&#039;s given a conventionally named CSS class.&#160; In automated UI tests, we can use that class to find the proper element and ensure that the screen is displaying the right thing.</p>
<p><a href="http://mhinze.com/wp-content/uploads/2009/07/image.png"><img title="image" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="204" alt="image" src="http://mhinze.com/wp-content/uploads/2009/07/image_thumb.png" width="244" border="0" /></a></p>
<p>Let me know if you have any questions.</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/automapper-in-nerddinner/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Free ASP.NET MVC event in Austin</title>
		<link>http://mhinze.com/free-aspnet-mvc-event-in-austin/</link>
		<comments>http://mhinze.com/free-aspnet-mvc-event-in-austin/#comments</comments>
		<pubDate>Thu, 11 Jun 2009 11:59:59 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Community]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://mhinze.com/free-aspnet-mvc-event-in-austin/</guid>
		<description><![CDATA[Jeffrey and Eric will be delivering a free afternoon of ASP.NET MVC in Austin on Tuesday, June 16th.&#160; If you haven&#039;t yet had a run-in with the new framework or if you&#039;re ready to see what we&#039;ve learned using ASP.NET MVC in the field, this afternoon will be an excellent opportunity to compress learning and [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jeffreypalermo.com">Jeffrey</a> and <a href="http://www.lostechies.com/blogs/hex/">Eric</a> will be delivering a free <a href="http://www.headspringsystems.com/services/agile-training/mvc-training/">afternoon of ASP.NET MVC in Austin on Tuesday, June 16th</a>.&nbsp; If you haven&#039;t yet had a run-in with the new framework or if you&#039;re ready to see what we&#039;ve learned using ASP.NET MVC in the field, this afternoon will be an excellent opportunity to compress learning and maximize your time&#8230;&nbsp; </p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/free-aspnet-mvc-event-in-austin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Nested Closure</title>
		<link>http://mhinze.com/simple-nested-closure/</link>
		<comments>http://mhinze.com/simple-nested-closure/#comments</comments>
		<pubDate>Tue, 02 Jun 2009 02:42:33 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[dsl]]></category>
		<category><![CDATA[fluent interface]]></category>
		<category><![CDATA[patterns]]></category>

		<guid isPermaLink="false">http://mhinze.com/simple-nested-closure/</guid>
		<description><![CDATA[Nested closure is one of those fancy patterns Martin Fowler first coined (as far as I know) and published on his DSL WIP site. His formal definition:
Express statement sub-elements of a function call by putting them into a closure in an argument.

You pass a delegate as a method parameter. The receiving method executes the function [...]]]></description>
			<content:encoded><![CDATA[<p>Nested closure is one of those fancy patterns <a href="http://martinfowler.com/dslwip/NestedClosure.html">Martin Fowler first coined</a> (as far as I know) and published on his <a href="http://martinfowler.com/dslwip/index.html">DSL WIP</a> site. His formal definition:</p>
<blockquote><p><i>Express statement sub-elements of a function call by putting them into a closure in an argument.</i></p>
</blockquote>
<p>You pass a delegate as a method parameter. The receiving method executes the function represented by that delegate against an object it controls.&nbsp; Nested closure in C# is easy to spot because the delegate is usually typed as <em>Action&lt;T&gt;</em>, where <em>T</em> is the type of the object that the called method will provide as a parameter to our argument function.</p>
<p>The most obvious example is a common extension method:</p>
<pre class="code"><span style="color: blue">public static void </span>ForEach&lt;T&gt;(<span style="color: blue">this </span><span style="color: #2b91af">IEnumerable</span>&lt;T&gt; items, <span style="color: #2b91af">Action</span>&lt;T&gt; action)
{
    <span style="color: blue">foreach </span>(T item <span style="color: blue">in </span>items)
    {
        action(item);
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Nested closure is like <a href="http://www.dofactory.com/Patterns/PatternTemplate.aspx">template method</a>, but instead of deriving from a base class to affect behavior, the additional behavior is provided as an argument.&nbsp; In the same way that template method is great when you want to communicate behavior from derivations to base classes, nested closure works when you want to communicate behavior as you call a method.</p>
<p>Consider working with a common series of steps when writing repository methods against NHibernate:</p>
<pre class="code"><span style="color: blue">public </span><span style="color: #2b91af">Order</span>[] GetAllOpenOrders(<span style="color: #2b91af">Customer </span>customer)
{
    <span style="color: #2b91af">ISession </span>session = GetSession();
    <span style="color: #2b91af">IQuery </span>query = session.CreateQuery(<span style="color: #a31515">"from Order o where o.Resolution is null and o.Customer = ?"</span>);
    query.SetEntity(0, customer);
    <span style="color: blue">var </span>results = query.List&lt;<span style="color: #2b91af">Order</span>&gt;().ToArray();
    <span style="color: blue">return </span>results;
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Code like this &#8211; where you have the same basic structure in several methods &#8211; can be made more terse by using a nested closure.</p>
<pre class="code"><span style="color: blue">public </span><span style="color: #2b91af">Order</span>[] GetShippedOrders(<span style="color: #2b91af">Customer </span>customer)
{
    <span style="color: blue">const string </span>hql = <span style="color: #a31515">"select distinct s.Order from Shipment s where s.Order.Customer = ?"</span>;

    <span style="color: blue">return </span>Hql(hql, x =&gt; x.SetEntity(0, customer));
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>The second parameter is an <em>Action&lt;IQuery&gt;</em>.</p>
<pre class="code"><span style="color: blue">protected </span>T[] Hql(<span style="color: blue">string </span>query, <span style="color: #2b91af">Action</span>&lt;<span style="color: #2b91af">IQuery</span>&gt; additionalWork)
{
    <span style="color: #2b91af">IQuery </span>iquery = GetSession().CreateQuery(query);

    <span style="color: blue">if </span>(additionalWork != <span style="color: blue">null</span>)
        additionalWork(iquery);

    <span style="color: blue">return </span>iquery.List&lt;T&gt;().ToArray();
}</pre>
<p>Nested closures are also good for adding fluency to APIs.&nbsp; This is the context of Fowler&#039;s writing, and you can see it clearly in Rhino Mocks:</p>
<pre class="code">repository.AssertWasCalled(x =&gt; x.Save(<span style="color: blue">null</span>), o =&gt;
    {
        o.IgnoreArguments();
        o.Constraints(<span style="color: #2b91af">Property</span>.AllPropertiesMatch(visitToSave));
    });</pre>
<p>In this scenario we&#039;re passing a delegate that, when invoked later, helps Rhino Mocks configure options for its expectations.</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/simple-nested-closure/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>If I Wasn't Presenting All Day, This Would Be My Austin Code Camp Schedule</title>
		<link>http://mhinze.com/if-i-wasnt-presenting-all-day-this-would-be-my-austin-code-camp-schedule/</link>
		<comments>http://mhinze.com/if-i-wasnt-presenting-all-day-this-would-be-my-austin-code-camp-schedule/#comments</comments>
		<pubDate>Tue, 26 May 2009 23:36:16 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[austin code camp]]></category>

		<guid isPermaLink="false">http://mhinze.com/if-i-wasnt-presenting-all-day-this-would-be-my-austin-code-camp-schedule/</guid>
		<description><![CDATA[I&#039;m into the idea of a code camp.&#160; So many conferences and presentations I attend are chatty and abstract, it&#039;ll be good to see Studio and Resharper and keyboard shortcuts and macros and hard core programming fly around on projectors all day. Since I&#039;m facilitating for six hours, this is a list of sessions that [...]]]></description>
			<content:encoded><![CDATA[<p>I&#039;m into the idea of a code camp.&nbsp; So many conferences and presentations I attend are chatty and abstract, it&#039;ll be good to see Studio and Resharper and keyboard shortcuts and macros and hard core programming fly around on projectors all day. Since I&#039;m facilitating for six hours, this is a list of sessions that I&#039;m distraught to miss at <a href="http://adnug.org/AustinCodeCamp09">Austin Code Camp</a>:</p>
<ul>
<li><em>9:00 AM</em> <strong>Git for people</strong> by <a href="http://www.lostechies.com/blogs/joe_ocampo/">Joe Ocampo</a>.&nbsp; <br />I just want to see someone fly through using this so I can upgrade my understanding from novice to .. post-novice. Hopefully some msysgit tricks for the Windows crowd. Can someone record this?
<li><em>10:00 AM</em> <a href="http://www.lostechies.com/blogs/hex/">Eric Hexter</a>&#039;s talk on <strong>Project Automation &#8211; Learn about Build and Deployment Automation<br /></strong>Eric is a master on the subject and I&#039;d love to glean some tidbits from his repertoire.
<li><em>11:00 AM </em><strong>A Handful of Things You Can Do In Ruby That Scares the Pants Off of C# Developers</strong> by <a href="http://blog.scottbellware.com/">Scott Bellware</a><br />I&#039;m at least wary of dynamic languages (in the large), and I&#039;m sure Scott will challenge my (mis)understandings.&nbsp; Also hoping for a recording.
<li><em>12:45 PM </em><strong>Enterprise Architecture Patterns: Presentation, Business Logic, and Persistence </strong>by <a href="http://www.lostechies.com/blogs/chad_myers/">Chad Myers</a> and <a href="http://www.lostechies.com/blogs/johnteague/">John Teague</a><br />I <em>will</em> make it to this session, at least in part.. I know enough to know that there&#039;s so much I don&#039;t know.&nbsp; This one will be all about information literacy.
<li><em>2:45 PM</em> <strong>Test Driven JavaScript </strong>by John Teague<br />I hope John shows me a better way.. because mine is not frictionless.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/if-i-wasnt-presenting-all-day-this-would-be-my-austin-code-camp-schedule/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Austin Code Camp</title>
		<link>http://mhinze.com/austin-code-camp/</link>
		<comments>http://mhinze.com/austin-code-camp/#comments</comments>
		<pubDate>Mon, 25 May 2009 17:57:55 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[austin code camp]]></category>

		<guid isPermaLink="false">http://mhinze.com/austin-code-camp/</guid>
		<description><![CDATA[I&#039;ll facilitate two sessions at Austin Code Camp on May 30th.
The first is called Take It For A Test Drive &#8211; clearly a failed attempt at a witty name for a hands-on-keyboard workshop where participants will design and implement a new feature for CodeCampServer, an open source ASP.NET MVC project.&#160; We&#039;ll get our hands on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#039;ll facilitate two sessions at <a href="http://adnug.org/AustinCodeCamp09">Austin Code Camp</a> on May 30th.</p>
<p>The first is called <strong>Take It For A Test Drive</strong> &#8211; clearly a failed attempt at a witty name for a hands-on-keyboard workshop where participants will design and implement a new feature for <a href="http://codecampserver.org">CodeCampServer</a>, an open source ASP.NET MVC project.&nbsp; We&#039;ll get our hands on NHibernate, TDD, Rhino Mocks, Resharper.. and maybe some ASP.NET MVC (although I&#039;m hoping that we touch the UI as little as possible since that stuff tends to slow workshops like this).</p>
<p>Here&#039;s the abstract:</p>
<blockquote><p>Conception, design, tasking, testing, construction. We&#039;ll do it all by building a new feature into a .NET open source enterprise software application. We&#039;ll design as a team, test-drive the implementation, and use the tools that enable us to move fast. This is a hands-on, no holds barred opportunity to get down and dirty with TDD. Bring your laptop with required software installed: Visual Studio .NET 2008, TestDriven.NET, TortoiseSVN, Resharper 4.5, SQL Server 2005 Express with mixed mode authentication</p>
</blockquote>
<p>It&#039;s<strong> <em>really important</em></strong> that participants bring their laptops with all the software installed.&nbsp; If you can <a href="http://code.google.com/p/codecampserver/source/browse/trunk/README.txt">build Code Camp Server locally</a> and load the solution in Visual Studio, you&#039;re golden.&nbsp; This isn&#039;t a presentation, it&#039;s a workshop.</p>
<p>So here&#039;s how it will go down:</p>
<ul>
<li>A 15-20 minute warm-up that involves checking out the source code and building it locally.
<li>I&#039;ll do a quick (very quick) rundown of the project and demo some Resharper stuff.
<li>I&#039;ll do another very quick intro to TDD if necessary.
<li>Then I&#039;ll present the specifications for the new feature and the participants will hash out the requirements with me as I role-play a product owner.
<li>As a team we&#039;ll use pseudo-UML and sequence diagrams to figure out exactly what we&#039;ll be doing and we&#039;ll task it out step by step.
<li>Then we&#039;ll go heads down and implement the feature.&nbsp; I&#039;ll speak up and code on a projector at reasonable intervals.</li>
</ul>
<p>It&#039;s a commitment to attend this one &#8211; you&#039;ll dedicate most of the morning to a workshop.&nbsp; But if you are where I was a couple years ago &#8211; familiar with C# and most of the tools but needing help getting started with TDD and other techniques, I think you&#039;ll like this session.</p>
<p>In the afternoon I&#039;ll present my<strong> </strong><a href="http://mhinze.com/practical-ioc-slides-and-code/"><strong>Practical IOC</strong></a> talk.&nbsp; This one is a presentation. </p>
<p>Here&#039;s the abstract: </p>
<blockquote><p>From the basics to interesting, more advanced usage scenarios, we&#039;ll discover how inversion of control can give life to object oriented principles and enable higher quality and faster delivery.</p>
</blockquote>
<p>I&#039;d say it&#039;s intermediate level subject matter.&nbsp; I have modified it a little since I presented it last.&nbsp; This one is a few (awesome!) slides and then me coding through usage scenarios.</p>
<p>Hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/austin-code-camp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Welcome Eric Anderson</title>
		<link>http://mhinze.com/welcome-eric-anderson/</link>
		<comments>http://mhinze.com/welcome-eric-anderson/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 21:09:51 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[headspring]]></category>

		<guid isPermaLink="false">http://mhinze.com/welcome-eric-anderson/</guid>
		<description><![CDATA[Today at Headspring we&#039;re pleased to have Eric Anderson on board.&#160; Eric&#039;s been hanging around the Austin agile software development community for a few years, and he&#039;s been to many of the ALT.NET conferences, including the last one in Seattle.&#160; It&#039;s exciting to see the company grow in the right direction&#8230; welcome Eric!
]]></description>
			<content:encoded><![CDATA[<p>Today at <a href="http://headspringsystems.com/">Headspring</a> we&#039;re pleased to have <a href="http://testinfected.blogspot.com/">Eric Anderson</a> on board.&nbsp; Eric&#039;s been hanging around the Austin agile software development community for a few years, and he&#039;s been to many of the ALT.NET conferences, including the last one in Seattle.&nbsp; It&#039;s exciting to see the company grow in the right direction&#8230; welcome Eric!</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/welcome-eric-anderson/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SubControllers and ViewModel</title>
		<link>http://mhinze.com/subcontrollers-and-viewmodel/</link>
		<comments>http://mhinze.com/subcontrollers-and-viewmodel/#comments</comments>
		<pubDate>Mon, 09 Mar 2009 01:23:46 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[Add new tag]]></category>
		<category><![CDATA[viewmodel]]></category>

		<guid isPermaLink="false">http://mhinze.com/subcontrollers-and-viewmodel/</guid>
		<description><![CDATA[SubControllers solved a big problem for us when we first started our current project.&#160; I posted about them back in the day.
The problem was isolating authorization to view sections of a page.&#160; In other words, if you didn&#039;t have permission X, you couldn&#039;t see the top-left section of the screen.&#160; If you didn&#039;t have permission [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://groups.google.com/group/mvccontrib-discuss/browse_thread/thread/b050e21fe322c08a#">SubControllers</a> solved a big problem for us when we first started our current project.&nbsp; I <a href="http://mhinze.com/tag/subcontrollers/">posted about them</a> back in the day.</p>
<p>The problem was isolating authorization to view sections of a page.&nbsp; In other words, if you didn&#039;t have permission X, you couldn&#039;t see the top-left section of the screen.&nbsp; If you didn&#039;t have permission Y, you couldn&#039;t see top-right section of the screen.&nbsp; By composing the controllers that decided how to display the sections, we could test drive nicely each controller&#039;s authorization check and subsequent decision.</p>
<p>Later we embraced the ViewModel concept and are working with strongly-typed views.&nbsp; We found that using SubControllers wasn&#039;t the best approach in that situation, for a couple reasons: </p>
<p>First, that the view properly invokes the SubController remains untested.&nbsp; The responsibility for performing the interaction still rests with the view.&nbsp; So why not just make the authorization check in the view?&nbsp; </p>
<p>That&#039;s the other problem: scattered partial views can be a small maintenance headache.&nbsp; In our current project, after embracing the ViewModel, there just wasn&#039;t a pain that SubControllers cured.</p>
<p>We didn&#039;t abandon SubControllers because they didn&#039;t work, or because there was a flaw in the implementation, or because they were too complex, or anything like that.&nbsp; They may still be the right approach for a given screen.</p>
<p>If you&#039;re unsure how to share view pieces in your application, refer to <a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/01/27/asp-net-mvc-options-for-consolidating-html.aspx">Jimmy&#039;s excellent guide</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/subcontrollers-and-viewmodel/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>More On Value Objects</title>
		<link>http://mhinze.com/more-on-value-objects/</link>
		<comments>http://mhinze.com/more-on-value-objects/#comments</comments>
		<pubDate>Thu, 19 Feb 2009 23:57:52 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Domain-Driven Design]]></category>
		<category><![CDATA[ddd]]></category>
		<category><![CDATA[value objects]]></category>

		<guid isPermaLink="false">http://mhinze.com/more-on-value-objects/</guid>
		<description><![CDATA[A few days ago Dylan Beattie wrote a nice post about value objects.&#160; He explains the idea in a more palatable way than my attempt:
If it’s not clear how to model a particular element in your model, try asking “which one?” If the question makes sense within your own scenario then you’re probably dealing with [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago Dylan Beattie wrote a nice <a href="http://dylanbeattie.blogspot.com/2009/02/is-crisp-value-object.html">post about value objects</a>.&nbsp; He explains the idea in a more <em>palatable</em> way than <a href="http://mhinze.com/there-is-never-a-collection-of-value-objects/">my attempt</a>:</p>
<blockquote><p>If it’s not clear how to model a particular element in your model, try asking “which one?” If the question makes sense within your own scenario then you’re probably dealing with entities. If the question “which one” is meaningless <strong>in the context of your domain </strong>then you’re probably better off modeling the subject of the question as a value object.</p>
</blockquote>
<p> I suggest that if you&#039;re <em>maintaining</em> a collection, you implicitly care <em>which one</em>.</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/more-on-value-objects/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Practical IOC slides and code</title>
		<link>http://mhinze.com/practical-ioc-slides-and-code/</link>
		<comments>http://mhinze.com/practical-ioc-slides-and-code/#comments</comments>
		<pubDate>Tue, 10 Feb 2009 13:19:52 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[ioc]]></category>
		<category><![CDATA[presentation]]></category>

		<guid isPermaLink="false">http://mhinze.com/practical-ioc-slides-and-code/</guid>
		<description><![CDATA[Last night I presented a talk titled Practical Inversion Of Control to a packed house at the Austin .NET User Group.&#160; It was a blast.&#160; I&#039;d guess there were 80 developers there, maybe more.&#160; Interestingly, when I asked the room &#034;Who uses an IOC tool at work,&#034; about 10 hands went up, at the most.
I [...]]]></description>
			<content:encoded><![CDATA[<p>Last night I presented a talk titled <em>Practical Inversion Of Control</em> to a packed house at the Austin .NET User Group.&nbsp; It was a blast.&nbsp; I&#039;d guess there were 80 developers there, maybe more.&nbsp; Interestingly, when I asked the room &#034;Who uses an IOC tool at work,&#034; about 10 hands went up, at the most.</p>
<p>I tried to focus on the practices of using IOC tools, because there&#039;s a lot of abstract jibber-jabber about principles.&nbsp; Don&#039;t get me wrong, I love the principles and the theory.&nbsp; I just think talking about the practices creates a more powerful pedagogical vector through which a comprehension of the principles can &#034;sneak&#034; in.</p>
<p>If I do this talk again I&#039;ll scrap the open generics tidbit.&nbsp; <em>I</em> think it&#039;s really neat, and that&#039;s why I included it.&nbsp; But if one hasn&#039;t run into that pain, solving it isn&#039;t so cool, and it adds unnecessary complexity to the demonstration.&nbsp; I&#039;ll have to come up with something better to replace it.</p>
<p><a href="http://mhinze.googlecode.com/files/PracticalIOC.zip">Here&#039;s an archive of the slides, notes and demo code</a>.</p>
<p>And here&#039;s a thing, if you just want to browse a slightly mangled view of the slides: </p>
<div id="__ss_1011680" style="width: 425px; text-align: left"><embed src="http://static.slideshare.net/swf/ssplayer2.swf?doc=practical-inversion-of-control-1234269719764358-2&amp;stripped_title=practical-inversion-of-control" width="425" height="355" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always"></embed> </div>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/practical-ioc-slides-and-code/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Presenting at ADNUG</title>
		<link>http://mhinze.com/presenting-at-adnug/</link>
		<comments>http://mhinze.com/presenting-at-adnug/#comments</comments>
		<pubDate>Thu, 05 Feb 2009 21:23:28 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[Community]]></category>
		<category><![CDATA[speaking]]></category>

		<guid isPermaLink="false">http://mhinze.com/presenting-at-adnug/</guid>
		<description><![CDATA[I&#039;m presenting a talk titled Practical Inversion of Control at the Austin .Net User Group on Monday.&#160; This will be a beginner to intermediate level session in which we&#039;ll answer the &#034;what&#034;, &#034;why&#034; and &#034;how&#034; questions about IOC and explore both basic and more interesting usage scenarios &#8230;
]]></description>
			<content:encoded><![CDATA[<p>I&#039;m presenting a talk titled <em>Practical Inversion of Control</em> at the <a href="http://www.adnug.org/">Austin .Net User Group</a> on Monday.&nbsp; This will be a beginner to intermediate level session in which we&#039;ll answer the &#034;what&#034;, &#034;why&#034; and &#034;how&#034; questions about IOC and explore both basic and more interesting usage scenarios &#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://mhinze.com/presenting-at-adnug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
