<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>.NET</title>
        <link>http://geekswithblogs.net/Podwysocki/category/4457.aspx</link>
        <description>.NET</description>
        <language>en-US</language>
        <copyright>Matthew Podwysocki</copyright>
        <managingEditor>matthew.podwysocki@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>CMAP Code Camp Wrap Up - Dependency Injection and IoC Containers</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/04/13/121219.aspx</link>
            <description>I really enjoyed speaking at this past weekend's CMAP Code Camp.  I hope you all enjoyed my presentation on "Loosen Your Dependencies with Dependency Injection and Inversion of Control Containers".  It was a great discussion to have with everyone and I like to learn there as much as I teach.  &lt;br /&gt;
&lt;br /&gt;
I also enjoyed teaming up with &lt;a href="http://odetocode.com/blogs/scott/"&gt;Scott Allen&lt;/a&gt; on his "A Gentle Introduction to Mocking" where we talked about mocks versus stubs, test pattens and mock frameworks such as &lt;a href="http://www.ayende.com/projects/rhino-mocks/downloads.aspx"&gt;Rhino Mocks&lt;/a&gt; and &lt;a href="http://code.google.com/p/moq/"&gt;Moq&lt;/a&gt;.  Hopefully we'll be doing some more ping-pong sessions in the future.&lt;br /&gt;
&lt;br /&gt;
Once again, I'd like to plug my &lt;a href="http://altnet.ent0.com/MainPage.ashx"&gt;DC ALT.NET&lt;/a&gt; group that I run.  Our next meeting is scheduled for April 23rd and the topic will be Continuous Integration with &lt;a href="http://jayflowers.com/joomla/"&gt;Jay Flowers&lt;/a&gt;.  We'll announce the location shortly for our group.  You can go ahead and sign up for our mailing list &lt;a href="http://tech.groups.yahoo.com/group/dcaltnet/"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Anyhow, here are some resources that can help point you in the right direction.  This includes articles, blogs and such that I find will be useful in your journey to better understand these things:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;Articles
    &lt;ul&gt;
        &lt;li&gt;&lt;a href="http://www.objectmentor.com/resources/articles/dip.pdf"&gt;The Dependency Inversion Principle&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="http://www.codeproject.com/KB/architecture/introducingcastle.aspx"&gt;Introducing Castle - Part I&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="http://martinfowler.com/eaaDev/PassiveScreen.html"&gt;Model View Presenter - Passive View&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="http://martinfowler.com/eaaDev/SupervisingPresenter.html"&gt;Model View Presenter - Supervising Controller&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Blogs
    &lt;ul&gt;
        &lt;li&gt;&lt;a href="http://www.martinfowler.com/articles/injection.html"&gt;Inversion of Control Containers and the Dependency Injection pattern&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="http://martinfowler.com/bliki/InversionOfControl.html"&gt;MF Bliki - Inversion of Control&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx"&gt;List of .NET Dependency Injection Containers (IOC)&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;Books
    &lt;ul&gt;
        &lt;li&gt;&lt;a href="http://www.amazon.com/Principles-Patterns-Practices-Robert-Martin/dp/0131857258/ref=sr_1_1?ie=UTF8&amp;amp;s=books&amp;amp;qid=1207865320&amp;amp;sr=1-1"&gt;Agile Principles, Patterns and Practices in C#&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612"&gt;Design Patterns: Elements of Reusable Object-Oriented Software&lt;/a&gt;&lt;/li&gt;
        &lt;li&gt;&lt;a href="http://www.amazon.com/Enterprise-Application-Architecture-Addison-Wesley-Signature/dp/0321127420/ref=pd_sim_b_title_5"&gt;Patterns of Enterprise Application Architecture&lt;/a&gt;&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
&lt;/ul&gt;
My presentation materials have just been uploaded to my &lt;a href="http://skydrive.live.com"&gt;SkyDrive&lt;/a&gt;.  The PowerPoint presentation can be found &lt;a href="http://cid-102e0d11b5a19652.skydrive.live.com/self.aspx/Public/IoC_Container_Training.pptx"&gt;here&lt;/a&gt; and the code samples can be found &lt;a href="http://cid-102e0d11b5a19652.skydrive.live.com/self.aspx/Public/Samples.rar"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
If you note, I my code uses the following products in order to get it to run:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://asp.net/mvc/"&gt;ASP.NET MVC Preview 2&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://codeplex.com/xunit"&gt;xUnit.net&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://castleproject.org/"&gt;Castle Windsor&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://structuremap.sourceforge.net/"&gt;StructureMap&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://codeplex.com/unity"&gt;Unity Application Block&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.codeplex.com/unitycontributions"&gt;Unity Community Contributions&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
Feedback is always appreciated.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/04/13/121219.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/04/13/121219.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=121219"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=121219" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/121219.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/04/13/121219.aspx</guid>
            <pubDate>Mon, 14 Apr 2008 04:45:14 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/121219.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/04/13/121219.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/121219.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/121219.aspx</trackback:ping>
        </item>
        <item>
            <title>Unity Community Contributions and Interception</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/04/11/121194.aspx</link>
            <description>Now that Unity has been released into the wild, there has definitely been a bit of interest swirling around it.  One of my key wants for a good IoC container is basic interception capabilities.  My criteria for evaluating a container usually comes down to the following:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;Configurability (XML, DSL, Code)&lt;/li&gt;
    &lt;li&gt;Dependency Resolution, usually opinionated&lt;/li&gt;
    &lt;li&gt;Lifetime Management (Per Thread, Pooled, Singleton, Transient, etc)&lt;/li&gt;
    &lt;li&gt;Extensibility for Interception&lt;/li&gt;
&lt;/ul&gt;
So, I realized that Unity was missing some of these things in the first go around.  Since Unity was built on top of ObjectBuilder2, a next generation version of the often maligned ObjectBuilder which also included some sample DI containers and a flexible interception model.  Today's post will cover that and a bit more.  I realize that I still am working on a post of AOP in the Enterprise and Spring.NET which is coming soon.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;
&lt;br /&gt;
Where We Are&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
But, before we begin today, let's see what we've already covered in the past:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/04/07/unity-1-0-released-into-the-wild.aspx"&gt;Unity 1.0 Released into the Wild&lt;/a&gt;&lt;br /&gt;
    Unity 1.0 released and available on MSDN.  Unfortunately, registration is required...&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/03/27/ioc-and-unity-configuration-changes-for-the-better.aspx"&gt;IoC and Unity - Configuration Changes for the Better&lt;/a&gt;&lt;br /&gt;
    Covers the configuration changes to allow for better parameterization for constructors&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/03/25/ioc-and-unity-the-basics-and-interception.aspx"&gt;IoC and Unity - The Basics and Interception&lt;/a&gt;&lt;br /&gt;
    Talking about the basics of IoC containers and the interception models&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/03/07/ioc-container-unity-and-breaking-changes-galore.aspx"&gt;IoC Container, Unity and Breaking Changes Galore&lt;/a&gt;&lt;br /&gt;
    Covers the breaking changes made from the old Unity drop to the new one&lt;br /&gt;
    &lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/03/04/ioc-containers-unity-and-objectbuilder2-the-saga-continues.aspx"&gt;&lt;br /&gt;
    &lt;/a&gt;     &lt;/li&gt;
    &lt;li&gt;&lt;a href="javascript:void(0);/*1206509408817*/"&gt;IoC Containers, Unity and ObjectBuilder2 - The Saga Continues&lt;/a&gt;&lt;br /&gt;
    Managing instances and parameter mapping resolution&lt;br /&gt;
    &lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/02/26/120002.aspx"&gt;&lt;br /&gt;
    &lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/02/26/ioc-and-the-unity-application-block-once-again.aspx"&gt;IoC and the Unity Application Block Once Again&lt;/a&gt;&lt;br /&gt;
    Setter Injection versus Constructor Injection and PostSharp4Unity&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/02/22/ioc-and-the-unity-application-block-going-deeper.aspx"&gt;IoC and the Unity Application Block - Going Deeper&lt;/a&gt;&lt;br /&gt;
    Constructor Injection and comparing Unity with Castle Windsor&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/02/18/ioc-and-the-unity-application-block.aspx"&gt;IoC and the Unity Application Block&lt;/a&gt;&lt;br /&gt;
    Covering ObjectBuilder and Unity Application Block&lt;/li&gt;
&lt;/ul&gt;
Now that we've look at the history of this series, let's go ahead and get started.&lt;br /&gt;
&lt;br style="font-weight: bold;" /&gt;
&lt;span style="font-weight: bold;"&gt;Unity Contributions&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Since Unity was released last Friday, there has been a community effort much like the ASP.NET MVC Contributions, &lt;a href="http://www.codeplex.com/MVCContrib"&gt;MVCContrib&lt;/a&gt;, called &lt;a href="http://www.codeplex.com/unitycontributions"&gt;Unity Community Contributions&lt;/a&gt;.  This project is intended to fill in the gaps where the community feels that Unity can be extended, much like most other IoC containers.  As I stated above, one of those crucial things that I thought was missing was taking the ObjectBuilder2 Interception model and applying it towards Unity.  I wasn't interested as much in the Policy Injection Application Block, although nice, is a bit heavyweight for the basic operations I would like.  Instead, the OB2 would suffice for most things that I'd want with a container.  So, that led me to another topic...&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;ObjectBuilder2 Interception == Unity Interception?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Since I was particularly motivated to see the OB2 Interception model pushed into Unity, I decided to give it a go myself.  For the most part, I was successful in a way, but I wasn't using the right extensibility model.  From that point, I got in contact with&lt;a href="http://blogs.msdn.com/scottdensmore/"&gt; Scott Densmore&lt;/a&gt;, a PM within the Patterns &amp;amp; Practices group and one of the authors of ObjectBuilder2 along with &lt;a href="http://bradwilson.typepad.com/"&gt;Brad Wilson&lt;/a&gt;.  From that point, he was able to take the original OB2 Interception model and fit it nicely into the Unity extensibility model.  The code is now available on the Unity Community Contributions and you can find those commits by Scott &lt;a href="http://www.codeplex.com/unitycontributions/SourceControl/ListDownloadableCommits.aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
So, let's take a look at what it entails.  As I tell most people, you learn the most about the software with good unit, I mean behavioral tests where I can really grok the intent of the code much better than most documentation.  I encourage most people to do the same.  I'd rather stay away from those projects that don't have tests to back up their work.&lt;br /&gt;
&lt;br /&gt;
Like I said before, ObjectBuilder2 had several ways of intercepting calls.  There are several interception strategies worth mentioning:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;Virtual Method interception&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;Interface Method interception&lt;/li&gt;
    &lt;li&gt;.NET Remoting interception (MarshalByRefObject)&lt;/li&gt;
&lt;/ul&gt;
From that, you have two ways of registering your interest for interception:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;Intercept via code&lt;/li&gt;
    &lt;li&gt;Intercept via attributes&lt;/li&gt;
&lt;/ul&gt;
Now that we've laid down the basics, let's take a look at some of the unit tests.  You'll notice that &lt;a href="http://codeplex.com/xunit"&gt;xUnit.net&lt;/a&gt; was used for the unit tests.  Yes, I know, I've mentioned it a few times lately.  Anyhow, let's look first at virtual method interception.&lt;br /&gt;
&lt;br /&gt;
Before we get started on that, in order to perform interception, we need to implement the IInterceptionHandler interface.  For the unit tests, this will be used to record the various actions that happened during the interception process.  But you can imagine it to do any number of things such as logging, transaction management, security and so on.  Any of those cross cutting concerns, really.&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;}??\fs16 \cf1\cb2\highlight2 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 public\cf3  \cf1 static\cf3  \cf1 class\cf3  \cf4 IoC\par ??\cf3     \{\par ??        \cf1 private\cf3  \cf1 static\cf3  \cf5 IDependencyResolver\cf3  resolver;\par ??\par ??        \cf1 public\cf3  \cf1 static\cf3  \cf1 void\cf3  Initialize(\cf5 IDependencyResolver\cf3  resolver)\par ??        \{\par ??            \cf4 IoC\cf3 .resolver = resolver;\par ??        \}\par ??\par ??        \cf1 public\cf3  \cf1 static\cf3  T Resolve&amp;lt;T&amp;gt;()\par ??        \{\par ??            \cf1 return\cf3  resolver.Resolve&amp;lt;T&amp;gt;();\par ??        \}\par ??\par ??        \cf1 public\cf3  \cf1 static\cf3  T Resolve&amp;lt;T&amp;gt;(\cf1 string\cf3  name)\par ??        \{\par ??            \cf1 return\cf3  resolver.Resolve&amp;lt;T&amp;gt;(name);\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;&lt;br /&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 153, 0);"&gt;public delegate&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;IMethodReturn&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;InovkeHandlerDelegate&lt;/span&gt;&lt;span style="color: rgb(0, 204, 255);"&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;IMethodInvocation&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;call,&lt;/span&gt;&lt;br /&gt;
                                                        &lt;span style="color: rgb(43, 145, 175);"&gt;GetNextHandlerDelegate&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;getNext);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
    &lt;span style="color: rgb(255, 153, 0);"&gt;public delegate&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;InovkeHandlerDelegate&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;GetNextHandlerDelegate&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;();&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
    &lt;span style="color: rgb(255, 153, 0);"&gt;public interface&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;IInterceptionHandler&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: rgb(255, 255, 255);"&gt;     {&lt;/span&gt;&lt;br /&gt;
        &lt;span style="color: rgb(43, 145, 175);"&gt;IMethodReturn &lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;Invoke(&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;IMethodInvocation&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;call,&lt;/span&gt;&lt;br /&gt;
                             &lt;span style="color: rgb(43, 145, 175);"&gt;GetNextHandlerDelegate&lt;/span&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;getNext);&lt;/span&gt;&lt;br style="color: rgb(255, 255, 255);" /&gt;
&lt;span style="color: rgb(255, 255, 255);"&gt;     }&lt;/span&gt;&lt;br style="color: rgb(255, 255, 255);" /&gt;
&lt;span style="color: rgb(255, 255, 255);"&gt; } &lt;/span&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;br /&gt;
&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;   &lt;span style="color: rgb(255, 153, 0);"&gt;public class&lt;/span&gt; &lt;span style="color: rgb(255, 255, 0);"&gt;RecordingHandler &lt;/span&gt;: &lt;span style="color: rgb(43, 145, 175);"&gt;IInterceptionHandler&lt;/span&gt;&lt;br /&gt;
    {&lt;br /&gt;
        &lt;span style="color: rgb(255, 153, 0);"&gt;readonly string &lt;/span&gt;message;&lt;br /&gt;
&lt;br /&gt;
        [&lt;span style="color: rgb(255, 255, 0);"&gt;InjectionConstructor&lt;/span&gt;]&lt;br /&gt;
        &lt;span style="color: rgb(255, 153, 0);"&gt;public &lt;/span&gt;RecordingHandler()&lt;br /&gt;
        {&lt;br /&gt;
            message = &lt;span style="color: rgb(0, 255, 0);"&gt;""&lt;/span&gt;;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;span style="color: rgb(255, 153, 0);"&gt;public &lt;/span&gt;RecordingHandler(&lt;span style="color: rgb(255, 153, 0);"&gt;string &lt;/span&gt;message)&lt;br /&gt;
        {&lt;br /&gt;
            &lt;span style="color: rgb(255, 153, 0);"&gt;this&lt;/span&gt;.message = &lt;span style="color: rgb(255, 153, 0);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(0, 255, 0);"&gt;" ({0})"&lt;/span&gt;, message);&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        &lt;span style="color: rgb(255, 153, 0);"&gt;public &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;IMethodReturn&lt;/span&gt; Invoke(&lt;span style="color: rgb(43, 145, 175);"&gt;IMethodInvocation&lt;/span&gt; call,&lt;br /&gt;
                                    &lt;span style="color: rgb(43, 145, 175);"&gt;GetNextHandlerDelegate&lt;/span&gt; getNext)&lt;br /&gt;
        {&lt;br /&gt;
            &lt;span style="color: rgb(255, 255, 0);"&gt;Recorder&lt;/span&gt;.Records.Add(&lt;span style="color: rgb(0, 255, 0);"&gt;"Before Method"&lt;/span&gt; + message);&lt;br /&gt;
            &lt;span style="color: rgb(43, 145, 175);"&gt;IMethodReturn &lt;/span&gt;result = getNext().Invoke(call, getNext);&lt;br /&gt;
            &lt;span style="color: rgb(255, 255, 0);"&gt;Recorder&lt;/span&gt;.Records.Add(&lt;span style="color: rgb(0, 255, 0);"&gt;"After Method" &lt;/span&gt;+ message);&lt;br /&gt;
            &lt;span style="color: rgb(255, 153, 0);"&gt;return &lt;/span&gt;result;&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
We have the ability through the Invoke method to do things before the method as well as after.  Should we need to modify values before the method is called, we can go ahead and do so.  Now that we looked at that, let's get to some unit tests.  First off, let's look at interception through just code.  I like this approach as opposed to attributes due to not cluttering the domain model and making it more configurable at run time.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;}??\fs16 \cf1\cb2\highlight2 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 public\cf3  \cf1 static\cf3  \cf1 class\cf3  \cf4 IoC\par ??\cf3     \{\par ??        \cf1 private\cf3  \cf1 static\cf3  \cf5 IDependencyResolver\cf3  resolver;\par ??\par ??        \cf1 public\cf3  \cf1 static\cf3  \cf1 void\cf3  Initialize(\cf5 IDependencyResolver\cf3  resolver)\par ??        \{\par ??            \cf4 IoC\cf3 .resolver = resolver;\par ??        \}\par ??\par ??        \cf1 public\cf3  \cf1 static\cf3  T Resolve&amp;lt;T&amp;gt;()\par ??        \{\par ??            \cf1 return\cf3  resolver.Resolve&amp;lt;T&amp;gt;();\par ??        \}\par ??\par ??        \cf1 public\cf3  \cf1 static\cf3  T Resolve&amp;lt;T&amp;gt;(\cf1 string\cf3  name)\par ??        \{\par ??            \cf1 return\cf3  resolver.Resolve&amp;lt;T&amp;gt;(name);\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;            [&lt;span style="color: yellow;"&gt;Fact&lt;/span&gt;]&lt;br /&gt;
            &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; InterceptViaCode()&lt;br /&gt;
            {&lt;br /&gt;
                &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records.Clear();&lt;br /&gt;
                &lt;span style="color: rgb(43, 145, 175);"&gt;IUnityContainer&lt;/span&gt; container = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;UnityContainer&lt;/span&gt;();&lt;br /&gt;
                container.AddNewExtension&amp;lt;&lt;span style="color: rgb(255, 255, 0);"&gt;InterceptionExtension&lt;/span&gt;&amp;gt;();&lt;br /&gt;
               container.Configure&lt;span style="color: rgb(255, 255, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;IInterceptionConfiguration&lt;/span&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&amp;gt;().&lt;/span&gt;InterceptVirtual&amp;lt;&lt;span style="color: rgb(255, 255, 0);"&gt;SpyVirtual&lt;/span&gt;&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                   (&lt;span style="color: rgb(255, 153, 0);"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(255, 255, 0);"&gt;SpyVirtual&lt;/span&gt;).GetMethod(&lt;span style="color: rgb(0, 255, 0);"&gt;"InterceptedMethod"&lt;/span&gt;), &lt;span style="color: rgb(255, 153, 0);"&gt;new &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;RecordingHandler&lt;/span&gt;());&lt;br /&gt;
&lt;br /&gt;
                &lt;span style="color: yellow;"&gt;SpyVirtual&lt;/span&gt; obj = container.Resolve&amp;lt;&lt;span style="color: yellow;"&gt;SpyVirtual&lt;/span&gt;&amp;gt;();&lt;br /&gt;
                obj.InterceptedMethod();&lt;br /&gt;
                obj.NonInterceptedMethod();&lt;br /&gt;
&lt;br /&gt;
                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(4, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records.Count);&lt;br /&gt;
                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: rgb(0, 255, 0);"&gt;"Before Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[0]);&lt;br /&gt;
                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: rgb(0, 255, 0);"&gt;"In Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[1]);&lt;br /&gt;
                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: rgb(0, 255, 0);"&gt;"After Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[2]);&lt;br /&gt;
                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: rgb(0, 255, 0);"&gt;"In Non-Intercepted Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[3]);&lt;br /&gt;
            }&lt;span style="color: rgb(255, 128, 0);"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;br /&gt;
            &lt;span style="color: rgb(255, 153, 0);"&gt;public class&lt;/span&gt; &lt;span style="color: rgb(255, 255, 0);"&gt;SpyVirtual&lt;/span&gt;&lt;br /&gt;
            {&lt;br /&gt;
                &lt;span style="color: rgb(255, 153, 0);"&gt;public virtual void&lt;/span&gt; InterceptedMethod()&lt;br /&gt;
                {&lt;br /&gt;
                    &lt;span style="color: rgb(255, 255, 0);"&gt;Recorder&lt;/span&gt;.Records.Add(&lt;span style="color: rgb(0, 255, 0);"&gt;"In Method"&lt;/span&gt;);&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                &lt;span style="color: rgb(255, 153, 0);"&gt;public void&lt;/span&gt; NonInterceptedMethod()&lt;br /&gt;
                {&lt;br /&gt;
                    &lt;span style="color: rgb(255, 255, 0);"&gt;Recorder&lt;/span&gt;.Records.Add(&lt;span style="color: rgb(0, 255, 0);"&gt;"In Non-Intercepted Method"&lt;/span&gt;);&lt;br /&gt;
                }&lt;br /&gt;
&lt;br /&gt;
                &lt;span style="color: rgb(255, 153, 0);"&gt;public virtual void&lt;/span&gt; ThrowsException()&lt;br /&gt;
                {&lt;br /&gt;
                    &lt;span style="color: rgb(255, 255, 0);"&gt;Recorder&lt;/span&gt;.Records.Add(&lt;span style="color: rgb(0, 255, 0);"&gt;"In Method"&lt;/span&gt;);&lt;br /&gt;
                    &lt;span style="color: rgb(255, 153, 0);"&gt;throw new&lt;/span&gt; Exception(&lt;span style="color: rgb(0, 255, 0);"&gt;"This is my exception!"&lt;/span&gt;);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;br /&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
As you see above, we can simply register our interest through the registration of the InterceptionExtension and then set up the configuration through the IInterceptionConfiguration.  From that point, we then say which kind of interception we want whether it be virtual, remoting or interfaces.  We specify the method we want to intercept by name.&lt;br /&gt;
&lt;br /&gt;
You can also do the interception through the use of attributes.  From this point, we need to decorate our methods with the attribute and the particular interception handler we want to use.  We need to be aware of which interception strategy we're using as well when we decorate our classes.  You can intercept methods as well as property accessors by decorating the get or set.  Below is a simple example of a virtual interceptor registration.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;}??\fs16 \cf1\cb2\highlight2 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 public\cf3  \cf1 static\cf3  \cf1 class\cf3  \cf4 IoC\par ??\cf3     \{\par ??        \cf1 private\cf3  \cf1 static\cf3  \cf5 IDependencyResolver\cf3  resolver;\par ??\par ??        \cf1 public\cf3  \cf1 static\cf3  \cf1 void\cf3  Initialize(\cf5 IDependencyResolver\cf3  resolver)\par ??        \{\par ??            \cf4 IoC\cf3 .resolver = resolver;\par ??        \}\par ??\par ??        \cf1 public\cf3  \cf1 static\cf3  T Resolve&amp;lt;T&amp;gt;()\par ??        \{\par ??            \cf1 return\cf3  resolver.Resolve&amp;lt;T&amp;gt;();\par ??        \}\par ??\par ??        \cf1 public\cf3  \cf1 static\cf3  T Resolve&amp;lt;T&amp;gt;(\cf1 string\cf3  name)\par ??        \{\par ??            \cf1 return\cf3  resolver.Resolve&amp;lt;T&amp;gt;(name);\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;             &lt;span style="color: rgb(255, 153, 0);"&gt;public class&lt;/span&gt; &lt;span style="color: rgb(255, 255, 0);"&gt;SpyVirtualAttributes&lt;/span&gt;&lt;br /&gt;
            {&lt;br /&gt;
                [&lt;span style="color: rgb(255, 255, 0);"&gt;VirtualIntercept&lt;/span&gt;(&lt;span style="color: rgb(255, 153, 0);"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(255, 255, 0);"&gt;RecordingHandler&lt;/span&gt;))]&lt;br /&gt;
                &lt;span style="color: rgb(255, 153, 0);"&gt;public virtual void&lt;/span&gt; InterceptedMethod()&lt;br /&gt;
                {&lt;br /&gt;
                    &lt;span style="color: rgb(255, 255, 0);"&gt;Recorder&lt;/span&gt;.Records.Add(&lt;span style="color: rgb(0, 255, 0);"&gt;"In Method"&lt;/span&gt;);&lt;br /&gt;
                }&lt;br /&gt;
            }&lt;/p&gt;
&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
I'm not going to post all of the tests, but I want to give you an idea of the power of this.  It's still early in the process and there is some cleanup still going on.  But, I encourage you to pick up the source, read it, grok it, give it a try and give feedback. &lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt; Conclusion&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
As you can see, the extensibility model of Unity works in that we can add interception to Unity.  So, we can start thinking about moving our cross cutting concerns to these layers should we so choose if Unity is your container of choice.  There are plenty of containers out there to choose from, so it's best to give them all a try and pick one based upon features, programming style, and heck, maybe even licensing.  I'll be showing some of this stuff off tomorrow at the CMAP Code Camp, so if you'll be at my 1PM session, be prepared.  Until next time... &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/04/11/121194.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/04/11/121194.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=121194"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=121194" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/121194.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/04/11/121194.aspx</guid>
            <pubDate>Sat, 12 Apr 2008 00:35:05 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/121194.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/04/11/121194.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/121194.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/121194.aspx</trackback:ping>
        </item>
        <item>
            <title>Unity 1.0 Released into the Wild</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/04/07/121088.aspx</link>
            <description>As &lt;a href="http://www.tavaresstudios.com/Blog/"&gt;Chris Tavares&lt;/a&gt; &lt;a href="http://www.tavaresstudios.com/Blog/post/Unity-10-is-released!.aspx"&gt;mentioned in his blog&lt;/a&gt;, &lt;a href="http://codeplex.com/unity"&gt;Unity 1.0&lt;/a&gt; has been released a couple of days earlier than the &lt;a href="http://blogs.msdn.com/agile/archive/2008/03/20/unity-release-date-changes-to-april-7.aspx"&gt;April 7th release date&lt;/a&gt; mentioned by &lt;a href="http://blogs.msdn.com/agile/"&gt;Grigori Melnik&lt;/a&gt; earlier.  &lt;a href="http://blogs.msdn.com/scottdensmore/archive/2008/04/04/unity-lives-get-your-copy-today.aspx"&gt;Scott Densmore&lt;/a&gt; also announced this as well as working on porting the inteception from ObjectBuilder2 which I talked about earlier in some of my Unity and IoC containers posts.  Looking forward to that post as we've shared some emails on the subject.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Would You Like To Know More?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
For those looking for my posts on the matter, I've covered it quite extensively with the comparison to other IoC containers as well as IoC containers in general:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/03/27/ioc-and-unity-configuration-changes-for-the-better.aspx"&gt;IoC and Unity - Configuration Changes for the Better&lt;/a&gt;&lt;br /&gt;
    Covers the latest configuration changes to allow for better constructor injection&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/03/25/ioc-and-unity-the-basics-and-interception.aspx"&gt;IoC and Unity - The Basics and Inteception&lt;/a&gt;&lt;br /&gt;
    Covers the basics of an IoC container and inteception techniques&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/03/07/ioc-container-unity-and-breaking-changes-galore.aspx"&gt;IoC Container, Unity and Breaking Changes Galore&lt;/a&gt;&lt;br /&gt;
    Covers the breaking changes made from the old Unity drop to the new one&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/03/04/ioc-containers-unity-and-objectbuilder2-the-saga-continues.aspx"&gt;IoC Containers, Unity and ObjectBuilder2 - The Saga Continues&lt;/a&gt;&lt;br /&gt;
    Managing instances and parameter mapping resolution&lt;br /&gt;
    &lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/02/26/120002.aspx"&gt;&lt;br /&gt;
    &lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/02/26/ioc-and-the-unity-application-block-once-again.aspx"&gt;IoC and the Unity Application Block Once Again&lt;/a&gt;&lt;br /&gt;
    Setter Injection versus Constructor Injection and PostSharp4Unity&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/02/22/ioc-and-the-unity-application-block-going-deeper.aspx"&gt;IoC and the Unity Application Block - Going Deeper&lt;/a&gt;&lt;br /&gt;
    Constructor Injection and comparing Unity with Castle Windsor&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/02/18/ioc-and-the-unity-application-block.aspx"&gt;IoC and the Unity Application Block&lt;/a&gt;&lt;br /&gt;
    Covering ObjectBuilder and Unity Application Block&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
Anyhow, if interesting in more Unity content, check out &lt;a href="http://codebetter.com/blogs/david.hayden/"&gt;David Hayden's&lt;/a&gt; Unity IoC and MVC screencast as well as others on the subject &lt;a href="http://codebetter.com/blogs/david.hayden/archive/2008/04/04/unity-ioc-and-asp-net-mvc-framework-screencast.aspx"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Speaking of which, I'm going to be a busy man indeed with my upcoming speaking schedule on IoC containers, not necessarily Unity in particular, but all of them, the background and decoupling your applications.  Here is the complete schedule for this month:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.rocknug.org/"&gt;RockNUG &lt;/a&gt;- April 9th&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.cmap-online.org/CodeCamp/"&gt;CMAP Code Camp&lt;/a&gt; - April 12th&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.cmap-online.org/Meetings/Details/2008-04-15.aspx"&gt;CMAP Architecture SIG&lt;/a&gt; - April 15th&lt;/li&gt;
&lt;/ul&gt;
I hope to contribute some at &lt;a href="http://altdotnet.org/events/seattle/"&gt;ALT.NET Open Spaces, Seattle&lt;/a&gt; as well on a few subjects and &lt;a href="http://altnet.ent0.com/"&gt;DC ALT.NET&lt;/a&gt; on April 23rd as well.  Should be a great time and feedback is always appreciated. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/04/07/121088.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/04/07/121088.aspx" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=121088"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=121088" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/121088.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/04/07/121088.aspx</guid>
            <pubDate>Mon, 07 Apr 2008 05:40:55 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/121088.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/04/07/121088.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/121088.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/121088.aspx</trackback:ping>
        </item>
        <item>
            <title>XUnit.net RC2 Released</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/03/31/120904.aspx</link>
            <description>&lt;span style="font-weight: bold;"&gt;UPDATE: More posts on the subject&lt;br /&gt;
&lt;/span&gt;
&lt;ul&gt;
    &lt;li style="font-weight: bold;"&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/04/10/xunit-net-rc3-just-released.aspx"&gt;xUnit.net RC3 Just Released&lt;/a&gt;&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/04/04/relooking-at-xunit-net-rc2.aspx" style="font-weight: bold;"&gt;Relooking at xUnit.net RC2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;
UPDATE: xUnit.NET RC2 New Drop includes ASP.NET MVC support and better GUI runner.  Details &lt;a href="http://bradwilson.typepad.com/blog/2008/04/xunitnet-rc2--1.html"&gt;here&lt;/a&gt;.&lt;br /&gt;
UPDATE: Added Static Methods mention and F# - Thanks to &lt;a href="http://devhawk.net"&gt;DevHawk&lt;/a&gt;!&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I've been a big fan of such testing frameworks as &lt;a href="http://www.nunit.org/"&gt;NUnit&lt;/a&gt; and &lt;a href="http://www.mbunit.com/"&gt;MbUnit&lt;/a&gt;, but recently I've found myself getting pulled more towards &lt;a href="http://codeplex.com/xunit"&gt;xUnit.net&lt;/a&gt; at least to play around with for any of my code samples that I write for this blog and on my own time.  I'm not really a fan of MSTest and many I think would agree about its deficiencies.  I won't go as far as say &lt;a href="http://jayflowers.com/joomla/"&gt;Jay Flowers&lt;/a&gt; and wear the shirt though...&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Another Release?&lt;/span&gt;&lt;br style="font-weight: bold;" /&gt;
&lt;br /&gt;
Recently, &lt;a href="http://bradwilson.typepad.com/"&gt;Brad Wilson&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/jamesnewkirk/default.aspx"&gt;Jim Newkirk&lt;/a&gt; recently announced the release of &lt;a href="http://codeplex.com/xunit"&gt;xUnit.net RC2&lt;/a&gt; on CodePlex.  I'd encourage you download the latest bits &lt;a href="http://www.codeplex.com/xunit/Release/ProjectReleases.aspx?ReleaseId=9681"&gt;here&lt;/a&gt;.  For those wondering what changes happened between RC1 and RC2, Brad has a good writeup on his blog &lt;a href="http://bradwilson.typepad.com/blog/2008/03/xunitnet-10-rc2.html"&gt;here&lt;/a&gt;.  What's interesting about this is the removal of the Assert class methods which take a user defined message should it fail.  I was never really a fan of those in the first place though.  &lt;br /&gt;
&lt;br /&gt;
Another interesting added features was the IUserFixture&amp;lt;T&amp;gt; which allows you to have a startup and teardown for your fixtures in a separate class and therefore reusable, unlike the current way of using no parameter constructors as your startup and the IDisposable.Dispose for your teardown.  See the tests in the FixtureExample for details.  But here's a snipped version of that code:&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red255\green128\blue0;\red255\green255\blue0;\red43\green145\blue175;\red0\green255\blue0;\red163\green21\blue21;}??\fs16 \cf1\cb2\highlight2     \cf3 public\cf1  \cf3 class\cf1  \cf4 DatabaseFixture\cf1  : \cf5 IDisposable\par ??\cf1     \{\par ??        \cf4 SqlConnection\cf1  connection;\par ??        \cf3 int\cf1  fooUserID;\par ??\par ??        \cf3 public\cf1  DatabaseFixture()\par ??        \{\par ??            \cf3 string\cf1  connectionString = \cf4 ConfigurationManager\cf1 .ConnectionStrings[\cf6 "DatabaseFixture"\cf1 ].ConnectionString;\par ??            connection = \cf3 new\cf1  \cf4 SqlConnection\cf1 (connectionString);\par ??            connection.Open();\par ??\par ??            \cf3 string\cf1  sql = \cf7 @"INSERT INTO Users VALUES ('foo', 'bar'); SELECT SCOPE_IDENTITY();"\cf1 ;\par ??\par ??            \cf3 using\cf1  (\cf4 SqlCommand\cf1  cmd = \cf3 new\cf1  \cf4 SqlCommand\cf1 (sql, connection))\par ??                fooUserID = \cf4 Convert\cf1 .ToInt32(cmd.ExecuteScalar());\par ??        \}\par ??\par ??        \cf3 public\cf1  \cf4 SqlConnection\cf1  Connection\par ??        \{\par ??            \cf3 get\cf1  \{ \cf3 return\cf1  connection; \}\par ??        \}\par ??\par ??        \cf3 public\cf1  \cf3 int\cf1  FooUserID\par ??        \{\par ??            \cf3 get\cf1  \{ \cf3 return\cf1  fooUserID; \}\par ??        \}\par ??\par ??        \cf3 public\cf1  \cf3 void\cf1  Dispose()\par ??        \{\par ??            \cf3 string\cf1  sql = \cf7 @"DELETE FROM Users WHERE ID = @id;"\cf1 ;\par ??\par ??            \cf3 using\cf1  (\cf4 SqlCommand\cf1  cmd = \cf3 new\cf1  \cf4 SqlCommand\cf1 (sql, connection))\par ??            \{\par ??                cmd.Parameters.AddWithValue(\cf6 "@id"\cf1 , fooUserID);\par ??                cmd.ExecuteNonQuery();\par ??            \}\par ??\par ??            connection.Close();\par ??        \}\par ??    \}}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;DatabaseFixture&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;IDisposable&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: yellow;"&gt;SqlConnection&lt;/span&gt; connection;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;int&lt;/span&gt; fooUserID;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; DatabaseFixture()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; connectionString = &lt;span style="color: yellow;"&gt;ConfigurationManager&lt;/span&gt;.ConnectionStrings[&lt;span style="color: lime;"&gt;"DatabaseFixture"&lt;/span&gt;].ConnectionString;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            connection = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;SqlConnection&lt;/span&gt;(connectionString);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            connection.Open();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; sql = &lt;span style="color: rgb(163, 21, 21);"&gt;@"INSERT INTO Users VALUES ('foo', 'bar'); SELECT SCOPE_IDENTITY();"&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; (&lt;span style="color: yellow;"&gt;SqlCommand&lt;/span&gt; cmd = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;SqlCommand&lt;/span&gt;(sql, connection))&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                fooUserID = &lt;span style="color: yellow;"&gt;Convert&lt;/span&gt;.ToInt32(cmd.ExecuteScalar());&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: yellow;"&gt;SqlConnection&lt;/span&gt; Connection&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;get&lt;/span&gt; { &lt;span style="color: rgb(255, 128, 0);"&gt;return&lt;/span&gt; connection; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;int&lt;/span&gt; FooUserID&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;get&lt;/span&gt; { &lt;span style="color: rgb(255, 128, 0);"&gt;return&lt;/span&gt; fooUserID; }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Dispose()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; sql = &lt;span style="color: rgb(163, 21, 21);"&gt;@"DELETE FROM Users WHERE ID = @id;"&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; (&lt;span style="color: yellow;"&gt;SqlCommand&lt;/span&gt; cmd = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;SqlCommand&lt;/span&gt;(sql, connection))&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                cmd.Parameters.AddWithValue(&lt;span style="color: lime;"&gt;"@id"&lt;/span&gt;, fooUserID);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                cmd.ExecuteNonQuery();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            connection.Close();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
What the above code allows us to do is to define a class that holds the data from the initialization of the first test, to the cleanup after the last test.  Our state is therefore maintained in a reusable manner.  As you will note, the startup logic resides in the default no parameter constructor and all teardown logic is in the IDisposable.Dispose method.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red255\green128\blue0;\red255\green255\blue0;\red43\green145\blue175;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2     \cf3 public\cf1  \cf3 class\cf1  \cf4 FixtureTests\cf1  : \cf5 IUseFixture\cf1 &amp;lt;\cf4 DatabaseFixture\cf1 &amp;gt;\par ??    \{\par ??        \cf4 DatabaseFixture\cf1  database;\par ??\par ??        \cf3 public\cf1  \cf3 void\cf1  SetFixture(\cf4 DatabaseFixture\cf1  data)\par ??        \{\par ??            database = data;\par ??        \}\par ??\par ??        [\cf4 Fact\cf1 ]\par ??        \cf3 public\cf1  \cf3 void\cf1  ConnectionIsEstablished()\par ??        \{\par ??            \cf4 Assert\cf1 .NotNull(database.Connection);\par ??        \}\par ??\par ??        [\cf4 Fact\cf1 ]\par ??        \cf3 public\cf1  \cf3 void\cf1  FooUserWasInserted()\par ??        \{\par ??            \cf3 string\cf1  sql = \cf6 "SELECT COUNT(*) FROM Users WHERE ID = @id;"\cf1 ;\par ??\par ??            \cf3 using\cf1  (\cf4 SqlCommand\cf1  cmd = \cf3 new\cf1  \cf4 SqlCommand\cf1 (sql, database.Connection))\par ??            \{\par ??                cmd.Parameters.AddWithValue(\cf6 "@id"\cf1 , database.FooUserID);\par ??\par ??                \cf3 int\cf1  rowCount = \cf4 Convert\cf1 .ToInt32(cmd.ExecuteScalar());\par ??\par ??                \cf4 Assert\cf1 .Equal(1, rowCount);\par ??            \}\par ??        \}\par ??    \}}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;FixtureTests&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;IUseFixture&lt;/span&gt;&amp;lt;&lt;span style="color: yellow;"&gt;DatabaseFixture&lt;/span&gt;&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: yellow;"&gt;DatabaseFixture&lt;/span&gt; database;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; SetFixture(&lt;span style="color: yellow;"&gt;DatabaseFixture&lt;/span&gt; data)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            database = data;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;   &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        [&lt;span style="color: yellow;"&gt;Fact&lt;/span&gt;]&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; FooUserWasInserted()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; sql = &lt;span style="color: lime;"&gt;"SELECT COUNT(*) FROM Users WHERE ID = @id;"&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; (&lt;span style="color: yellow;"&gt;SqlCommand&lt;/span&gt; cmd = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;SqlCommand&lt;/span&gt;(sql, database.Connection))&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                cmd.Parameters.AddWithValue(&lt;span style="color: lime;"&gt;"@id"&lt;/span&gt;, database.FooUserID);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(255, 128, 0);"&gt;int&lt;/span&gt; rowCount = &lt;span style="color: yellow;"&gt;Convert&lt;/span&gt;.ToInt32(cmd.ExecuteScalar());&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(1, rowCount);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
Then we can go ahead with our tests, while using the SqlConnection as defined on our DatabaseFixture.  After we're done with our test, it goes ahead and calls Dispose on the fixture.  I tend to like this approach and it's definitely growing on me.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Why xUnit.net?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
For those new to xUnit.net, there are some decent links to help you along.  Some of the more interesting ones can be found here:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.codeplex.com/xunit/Wiki/View.aspx?title=Comparisons&amp;amp;referringTitle=Home"&gt;Comparison to MbUnit, NUnit and MSTest&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.codeplex.com/xunit/Wiki/View.aspx?title=HowToUseResharper&amp;amp;referringTitle=Home"&gt;Running Resharper with xUnit.net&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://blog.benhall.me.uk/2008/01/introduction-to-xunit.html"&gt;An introduction to xUnit.net&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://blog.benhall.me.uk/2008/01/introduction-to-xunitnet-extensions.html"&gt;An introduction to xUnit.net extensions&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://blog.benhall.me.uk/2008/01/creating-your-own-xunit-extension.html"&gt;Create your own xUnit.net extension&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
But, why am I interested in it?  Well, let's just say that I think it tackles things in a slightly different manner.  I think one of the key pieces that I really like is the Assert.Throws instead of the clumsy ExpectedExceptionAttribute which you must clutter your tests with on the top.  I would rather assert that such a thing happened programmatically, so that I may analyze the exception.  I can also specify which line I expect during my test will throw the exception, instead of taking on blind faith that my test threw an exception.  It may be of the right type, but that may not have been the one you wanted, thus giving a false sense of security.&lt;br /&gt;
&lt;br /&gt;
To use this, just simply use the Assert.Throws&amp;lt;TException&amp;gt;(Assert.ThrowsDelegate) which I've found to be very helpful.  Let's look at a quick test of that being used.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red255\green255\blue0;\red255\green128\blue0;}??\fs16 \cf1\cb2\highlight2     [\cf3 Fact\cf1 ]\par ??    \cf4 public\cf1  \cf4 void\cf1  PopEmptyStack()\par ??    \{\par ??        \cf3 Stack\cf1 &amp;lt;\cf4 string\cf1 &amp;gt; stack = \cf4 new\cf1  \cf3 Stack\cf1 &amp;lt;\cf4 string\cf1 &amp;gt;();\par ??        \cf3 Assert\cf1 .Throws&amp;lt;\cf3 InvalidOperationException\cf1 &amp;gt;(() =&amp;gt; stack.Pop());\par ??    \}}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;    [&lt;span style="color: yellow;"&gt;Fact&lt;/span&gt;]&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; PopEmptyStack()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: yellow;"&gt;Stack&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;&amp;gt; stack = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;Stack&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Throws&amp;lt;&lt;span style="color: yellow;"&gt;InvalidOperationException&lt;/span&gt;&amp;gt;(() =&amp;gt; stack.Pop());&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
As you can see, we're pretty explicit about what line will throw the exception, and that's really the key to this scenario.  There are a good number of samples provided on the releases page that you should check out.  As always with most products that I talk about, I highly recommend reading the tests to really fully understand what's going on underneath the covers.  Not only does it help you understand the intent of the program, but you can learn about good coding techniques, design patterns, testing patterns and so on.&lt;br /&gt;
&lt;br /&gt;
Another point that xUnit.net separates itself from the pack is the ability to decorate static methods as facts.  This frees you from having to create an instance of your test class in order to call them.  Harry Pierson, aka DevHawk, demonstrates its use with regards to F# and testing the parse buffer &lt;a href="http://devhawk.net/2007/12/12/Practical+F+Parsing+Unit+Testing.aspx"&gt;here&lt;/a&gt;.  It definitely opened my eyes and a few more avenues as I pursue more F# related work items in the future.  Here's just a quick and dirty sample of showing how you can use xUnit.net with F# quite easily, just as Harry's post did.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red255\green128\blue0;}??\fs16 \cf1\cb2\highlight2 #light\par ??\par ??\cf3 let\cf1  \cf3 rec\cf1  fib n = \par ??  \cf3 match\cf1  n \cf3 with\par ??\cf1   | 0 \cf3 -&amp;gt;\cf1  1\par ??  | 1 \cf3 -&amp;gt;\cf1  1\par ??  | x \cf3 -&amp;gt;\cf1  fib(n - 2) + fib(n - 1)\par ??  \par ??print_any (fib (-1))}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;#light&lt;br /&gt;
&lt;br /&gt;
#R @&lt;span style="color: rgb(0, 255, 0);"&gt;"E:\Tools\xunit-build-1223-samples\Samples\xunit\xunit.dll" &lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: rgb(255, 128, 0);"&gt;open&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;System&lt;br /&gt;
&lt;span style="color: rgb(255, 128, 0);"&gt;open&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;System.Collections.Generic&lt;br /&gt;
&lt;span style="color: rgb(255, 128, 0);"&gt;open&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;Xunit&lt;br /&gt;
&lt;br /&gt;
&lt;span style="color: rgb(255, 128, 0);"&gt;type &lt;/span&gt;Stack&amp;lt;'t&amp;gt; = &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt;&lt;br /&gt;
  &lt;span style="color: rgb(255, 128, 0);"&gt;val&lt;/span&gt; elements : LinkedList&amp;lt;'t&amp;gt;&lt;br /&gt;
  &lt;br /&gt;
  new() = { elements = &lt;span style="color: rgb(255, 128, 0);"&gt;new &lt;/span&gt;LinkedList&amp;lt;'t&amp;gt;() }&lt;br /&gt;
  &lt;br /&gt;
  &lt;span style="color: rgb(255, 128, 0);"&gt;member&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;x.IsEmpty&lt;br /&gt;
    &lt;span style="color: rgb(255, 128, 0);"&gt;with &lt;/span&gt;get() = x.elements.Count = 0&lt;br /&gt;
    &lt;br /&gt;
  &lt;span style="color: rgb(255, 128, 0);"&gt;member&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;x.Push element =&lt;br /&gt;
    x.elements.AddFirst(element:'t)&lt;br /&gt;
    &lt;br /&gt;
  &lt;span style="color: rgb(255, 128, 0);"&gt;member&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;x.Top&lt;br /&gt;
    &lt;span style="color: rgb(255, 128, 0);"&gt;with &lt;/span&gt;get() =&lt;br /&gt;
      &lt;span style="color: rgb(255, 128, 0);"&gt;if &lt;/span&gt;x.elements.Count = 0 &lt;span style="color: rgb(255, 128, 0);"&gt;then&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
        raise (InvalidOperationException(&lt;span style="color: rgb(0, 255, 0);"&gt;"cannot top an empty stack"&lt;/span&gt;))&lt;br /&gt;
      x.elements.First.Value&lt;br /&gt;
      &lt;br /&gt;
  &lt;span style="color: rgb(255, 128, 0);"&gt;member&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;x.Pop = &lt;br /&gt;
    &lt;span style="color: rgb(255, 128, 0);"&gt;let&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;top = x.Top&lt;br /&gt;
    x.elements.RemoveFirst()&lt;br /&gt;
    top&lt;br /&gt;
&lt;span style="color: rgb(255, 128, 0);"&gt;end&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
[&amp;lt;Fact&amp;gt;]   &lt;br /&gt;
&lt;span style="color: rgb(255, 128, 0);"&gt;let&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;NoElementsShouldBeEmpty () =&lt;br /&gt;
  &lt;span style="color: rgb(255, 128, 0);"&gt;let&lt;/span&gt;&lt;span style="color: rgb(255, 128, 0);"&gt; &lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;stack = new Stack&amp;lt;string&amp;gt;()&lt;br /&gt;
  Assert.True(stack.IsEmpty)&lt;br /&gt;
&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
If you notice, the FactAttribute is placed on a static method called NoElementsShouldBeEmpty and sure enough it works like a champ through xUnit.net.  I like this approach instead of the pomp and circumstance required for creating classes as shown above with my Stack class.  Note the use of the empty parans which forces it to be a void method with no values passed either.  But if you run it through the xunit.console sure enough it succeeds like a champ.&lt;br /&gt;
&lt;br /&gt;
What are we missing though?  Well, I'm in favor of having a standalone GUI Test Runner much like NUnit and MbUnit have.  In fact, Brad has started this and you can get these features from the latest commits &lt;a href="http://www.codeplex.com/xunit/SourceControl/ListDownloadableCommits.aspx"&gt;here&lt;/a&gt;.  Mind you I haven't gotten it to work just right yet, but it's a work in progress.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
There is a lot to like about xUnit.net and takes a lot of lessons learned from the use of NUnit, MbUnit and others and I think they're doing a good job incorporating issues.  This project isn't as active as MbUnit and NUnit, but it's definitely one to keep an eye on.  Recent releases of NUnit and Gallio Automation Platform will probably be also covered in the short while as well as they have a lot to offer.  Until next time... &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/31/120904.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/31/120904.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120904"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120904" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/120904.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/03/31/120904.aspx</guid>
            <pubDate>Tue, 01 Apr 2008 00:31:06 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/120904.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/03/31/120904.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/120904.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/120904.aspx</trackback:ping>
        </item>
        <item>
            <title>Understanding AOP in .NET</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/03/28/120836.aspx</link>
            <description>In my previous posts I have talked a bit about Inversion of Control (IoC) containers with respect to Interception and Aspect Oriented Programming (AOP).  It's not only important to understand the uses and strategies for implementing your solutions using it, but also how interception and AOP works deep down in .NET.  Instead of a long, drawn out post, I think I'll just include some articles and posts that do a very good job of explaining some of the ideas behind it.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Articles and Posts&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
I think it'd be good if we just start out with some basic MSDN articles and such regarding AOP and interception.  Some of them may be older but the concepts will still apply to this day:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.ayende.com/Blog/archive/2007/07/02/7-Approaches-for-AOP-in-.Net.aspx"&gt;7 Approaches for AOP in .NET&lt;/a&gt;&lt;br /&gt;
    &lt;a href="http://www.ayende.com/"&gt;Ayende&lt;/a&gt; covers a few ways of doing AOP in .NET using existing frameworks&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://msdn2.microsoft.com/en-us/magazine/cc164165.aspx"&gt;Decouple Components by Injecting Custom Services into Your Object's Interception Chain&lt;/a&gt;&lt;br /&gt;
    &lt;a href="http://www.idesign.net/idesign/DesktopDefault.aspx?tabid=5&amp;amp;tabindex=3"&gt;Juval Lowy&lt;/a&gt;, in the March 2003 MSDN magazine, writes about using contexts for an object's execution scope and intercepting calls to and from that object.&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://msdn2.microsoft.com/en-us/library/aa288717(vs.71).aspx"&gt;Aspect Oriented Programming (September 2005 Technical article)&lt;br /&gt;
    &lt;/a&gt;&lt;a href="http://www.theagiledeveloper.com/"&gt;Matthew Deiters&lt;/a&gt; describes aspect oriented programming and covers joinpoints, pointcuts, advice and mixins with regards to a simple example using VB.NET.&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://msdn2.microsoft.com/en-us/magazine/cc301356.aspx"&gt;AOP: Apsect Oriented Programming Enables Better Code Encapsulation and Reuse&lt;/a&gt;&lt;br /&gt;
    &lt;a href="http://www.dharmashukla.com/"&gt;Dharma Shukla&lt;/a&gt;, &lt;a href="http://www.pocketsoap.com/weblog/"&gt;Simon Fell&lt;/a&gt; and &lt;a href="http://www.sellsbrothers.com/"&gt;Chris Sells&lt;/a&gt; write in the March 2002 MSDN Magazine with regards to the history to COM and AOP and then relate how it works in .NET.  Rather dated article but the foundations still apply.&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.codeproject.com/KB/architecture/AOP_Injection_IL.aspx"&gt;AOP using System.Reflection.Emit&lt;/a&gt;&lt;br /&gt;
    Roberto Loreto writes on CodeProject how to intercept method calls of an external type and generating method proxies by using Intermediate Language (IL) injection.&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Just Read the Code&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
There are many AOP frameworks out there in the wild right now for .NET.  To understand them pretty well, it's best if you just crack open the code and follow the unit tests.  Most of these are no longer active.  Let's cover some of the AOP frameworks out there:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.postsharp.org/"&gt;PostSharp&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://aspectsharpcomp.sourceforge.net/"&gt;NKalore &lt;/a&gt;(No longer active)&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.dcl.hpi.uni-potsdam.de/research/loom/gripper_loom.htm"&gt;Gripper LOOM.NET&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.dcl.hpi.uni-potsdam.de/research/loom/rapier_loom.htm"&gt;Rapier LOOM.NET&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://sourceforge.net/projects/aopnet/"&gt;AOP.NET&lt;/a&gt; (No longer active)&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.castleproject.org/aspectsharp/index.html"&gt;Aspect#&lt;/a&gt; (No longer active)&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://aspectdng.tigris.org/"&gt;AspectDNG&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
Many containers also implement AOP through the IoC container such as:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.castleproject.org/container/"&gt;Castle Windsor&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.puzzleframework.com/wikiengine/wikipageviewer.aspx?page=home"&gt;Puzzle.NET&lt;/a&gt;&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.springframework.net/"&gt;Spring.NET&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://s2container.net.seasar.org/"&gt;S2Container&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.codeproject.com/KB/cs/LinFuPart1.aspx"&gt;LinFu&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.codeplex.com/ObjectBuilder/SourceControl/DownloadSourceCode.aspx?changeSetId=29957"&gt;ObjectBuilder2&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="font-weight: bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
For those willing and able to go ahead and learn about AOP, it's actually quite interesting.  it's also quite a challenge especially when dealing with IL emitting.  Go ahead and look at the source code and samples and give some of it a try.  Next time we pick up, I'll be talking about AOP in the Enterprise and Spring.NET.  Until next time...
&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/28/120836.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/28/120836.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120836"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120836" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/120836.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/03/28/120836.aspx</guid>
            <pubDate>Sat, 29 Mar 2008 00:45:16 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/120836.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/03/28/120836.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/120836.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/120836.aspx</trackback:ping>
        </item>
        <item>
            <title>Looking at DSLs in .NET</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/03/18/120624.aspx</link>
            <description>As I've mentioned in recent posts such as &lt;a href="http://geekswithblogs.net/podwysocki/archive/2008/02/08/adventures-in-compilers-building-on-the-dlr.aspx" mce_href="/podwysocki/archive/2008/02/08/adventures-in-compilers-building-on-the-dlr.aspx"&gt;here&lt;/a&gt;, &lt;a href="http://geekswithblogs.net/podwysocki/archive/2008/02/06/dsls-compilers-and-the-irony-of-it-all.aspx" mce_href="/podwysocki/archive/2008/02/06/dsls-compilers-and-the-irony-of-it-all.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://geekswithblogs.net/podwysocki/archive/2008/02/04/lang-net-and-rolling-your-own.aspx" mce_href="/podwysocki/archive/2008/02/04/lang-net-and-rolling-your-own.aspx"&gt;here&lt;/a&gt;, I've been very interested in Domain Specific Languages (DSLs), especially with regards to F# and the DLR as well.  I recently re-listened to &lt;a href="http://www.se-radio.net/" mce_href="http://www.se-radio.net/"&gt;Software Engineering Radio&lt;/a&gt; Episode 52 with &lt;a href="http://obiefernandez.com/" mce_href="http://obiefernandez.com/"&gt;Obie Fernandez&lt;/a&gt; discussing &lt;a href="http://www.se-radio.net/podcast/2007-04/episode-52-dsl-development-ruby" mce_href="http://www.se-radio.net/podcast/2007-04/episode-52-dsl-development-ruby"&gt;DSLs in Ruby&lt;/a&gt;.   One of the things that attracted me to Ruby for this was the flexibility of the syntax for closures, mixins, etc.  Anyhow, it's a good listen and if you're new to the subject, you should give it a go.  Also, there is a slide deck of DSLs in Ruby which accompanies this episode which can be found &lt;a href="http://obiefernandez.com/presentations/obie_fernandez-agile_dsl_development_in_ruby.pdf" mce_href="http://obiefernandez.com/presentations/obie_fernandez-agile_dsl_development_in_ruby.pdf"&gt;here&lt;/a&gt;.  &lt;br /&gt;
&lt;br /&gt;
So, of course this gets me excited about the possibilities of seeing such things in &lt;a href="http://www.ironruby.net/" mce_href="http://www.ironruby.net/"&gt;IronRuby&lt;/a&gt;.  After seeing &lt;a href="http://iunknown.com/" mce_href="http://iunknown.com/"&gt;John Lam's&lt;/a&gt; presentations at MIX08 and listening to him on various podcasts, I'm excited that they are making such progress and hopefully get it into our hands soon.&lt;br /&gt;
&lt;br /&gt;
But, before we get too deep into things, I just want to take a step back and look quickly at what DSLs are.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Internal and External DSLs?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
So, what are DSLs?  Well, to put it succinctly, it's a small language that's used for a very narrow task.  You can think of these as languages specific to a domain such as medical claims processing, stock trading and so on that only have meaning there.  These languages mean very little outside their problem domain and probably wouldn't make sense to anyone outside.  I'm very well aware of such things as I've worked in the medical claims processing industry and their terms, calculations and so on are very specific and to solve the problem well, it's best to suit the language best for expressing solutions.&lt;br /&gt;
&lt;br /&gt;
Martin Fowler wrote an article entitled &lt;a href="http://www.martinfowler.com/articles/languageWorkbench.html" mce_href="http://www.martinfowler.com/articles/languageWorkbench.html"&gt;"Language Workbenches: The Killer-App For Domain Specific Languages?"&lt;/a&gt; in which he talks about the history of DSLs especially in the Lisp world, but until now really haven't caught on.  Martin argues that XML structures such as configuration files, and so on qualify for that status, due to the fact that it is readable by a human and probably a domain expert as well.  But Lisp is well know for the Lex/Yacc parsing and expression trees and so on.&lt;br /&gt;
&lt;br /&gt;
Now the real interesting part comes in when we talk about internal versus external DSLs...&lt;br /&gt;
&lt;br /&gt;
External DSLs, quite simply, are those languages that are not in the same language as the main application itself.  This means that I could be free to write any free-form code I wish in order to suit my domain specific need.  This means that you need to write parsers and then ultimately would need to have a translation boundary between your DSL and your application.  This is where I think something like the Dynamic Language Runtime (DLR) could come into play.  What I mean by that is that if you write your language parser for the DLR, and I'll get into that shortly.  There is a bit of overhead with this of course, plus a good debugger and IDE, but with time and patience things like this can be overcome.  Extending such things as #Develop to encompass those pieces is feasible.&lt;br /&gt;
&lt;br /&gt;
Internal DSLs, on the other hand, are the little languages you can create inside your current language of choice.  Now languages such as Lisp, Ruby, Scala, Boo, and F# seem a bit more suited for these than the mainstream languages of C++, C# and Java.  Of course one of the bigger obstacles is the pesky curly brace which Ruby allows you to discard.  F# doesn't have a concept of this either, and instead the indentation scopes the values and functions and so on.  Martin has an &lt;a href="http://www.martinfowler.com/articles/mpsAgree.html" mce_href="http://www.martinfowler.com/articles/mpsAgree.html"&gt;interesting DSL&lt;/a&gt; written in Java that's interesting and could be better applied in different languages.  &lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Thinking About The DLR&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
As I said before, I'm pretty excited about the DLR and the flexibility it can give me as a software engineer looking for new and better ways to solve my customer's problems.  Not only that, but I'm a language geek at heart, what can I say?  I've posted several items on building on the DLR in the context of external DSLs as well as writing custom compilers for .NET.  Projects such as &lt;a href="http://codeplex.com/irony" mce_href="http://codeplex.com/irony"&gt;Irony&lt;/a&gt; also appeal to me in that way.  &lt;br /&gt;
&lt;br /&gt;
If you want to play around with the DLR, you can get it in one of two places, the &lt;a href="http://codeplex.com/IronPython" mce_href="http://codeplex.com/IronPython"&gt;IronPython download&lt;/a&gt; on CodePlex or on &lt;a href="http://rubyforge.org/projects/ironruby" mce_href="http://rubyforge.org/projects/ironruby"&gt;RubyForge&lt;/a&gt; with the &lt;a href="http://www.ironruby.net/" mce_href="http://www.ironruby.net/"&gt;IronRuby project&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://blogs.msdn.com/mmaly/" mce_href="http://blogs.msdn.com/mmaly/"&gt;Martin Maly&lt;/a&gt;, a member of the DLR team has continued his posts about Building on the DLR.  He took some time off to work on some DLR related issues and now is back with some more posts. Let's continue where we left off last time:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://blogs.msdn.com/mmaly/archive/2008/02/29/building-a-dlr-language-answering-some-questions.aspx" mce_href="http://blogs.msdn.com/mmaly/archive/2008/02/29/building-a-dlr-language-answering-some-questions.aspx"&gt;Answering Some Questions&lt;/a&gt;&lt;br /&gt;
    Martin talks about Static and Dynamic Nodes on DLR Trees&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://blogs.msdn.com/mmaly/archive/2008/02/29/variations-on-trees.aspx" mce_href="http://blogs.msdn.com/mmaly/archive/2008/02/29/variations-on-trees.aspx"&gt;Variations on Trees&lt;/a&gt;&lt;br /&gt;
    Martin talks about DLR trees and LINQ Expression trees&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://blogs.msdn.com/mmaly/archive/2008/03/03/building-a-dlr-language-more-questions.aspx" mce_href="http://blogs.msdn.com/mmaly/archive/2008/03/03/building-a-dlr-language-more-questions.aspx"&gt;More questions&lt;/a&gt;&lt;br /&gt;
    Martin talks about implementing a Print method that acts differently per incoming data type&lt;br /&gt;
    &lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://blogs.msdn.com/mmaly/archive/2008/03/03/building-a-dlr-language-extension-methods.aspx" mce_href="http://blogs.msdn.com/mmaly/archive/2008/03/03/building-a-dlr-language-extension-methods.aspx"&gt;Extension Methods&lt;/a&gt;&lt;br /&gt;
    Martin talks about adding extension methods to the ToyScript sample&lt;/li&gt;
&lt;/ul&gt;
So, as you can see, the DLR has progressed quite a bit, and maybe creating that DSL using the DLR isn't so far off after all.  That is of course if you understand expression trees and so on.  But, the great part about the DLR is that they ship the ToyScript source code with this for you to play with and learn from when you download it.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;DSLs In Boo?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://ayende.com/Blog/Default.aspx" mce_href="http://ayende.com/Blog/Default.aspx"&gt;Oren Eini, aka Ayende&lt;/a&gt;, has been working on a book about DSLs called &lt;a href="http://www.manning.com/affiliate/idevaffiliate.php?id=854_111" mce_href="http://www.manning.com/affiliate/idevaffiliate.php?id=854_111"&gt;"Building Domain Specific Languages in Boo"&lt;/a&gt;.  Recently, &lt;a href="http://ayende.com/Blog/archive/2008/03/14/New-version-of-the-book-out.aspx" mce_href="http://ayende.com/Blog/archive/2008/03/14/New-version-of-the-book-out.aspx"&gt;he posted&lt;/a&gt; about some sample chapters now available online with the source code.  I highly recommend that you at least give it a look.  You now have access to the Early Access Edition, and of course you can buy it online.  It'll be interesting to see Ayende at &lt;a href="http://altdotnet.org/events/seattle" mce_href="http://altdotnet.org/events/seattle"&gt;ALT.NET Open Spaces, Seattle&lt;/a&gt; to see if he wants to cover more of this stuff.  &lt;br /&gt;
&lt;br /&gt;
If you're not familiar with &lt;a href="http://boo.codehaus.org/" mce_href="http://boo.codehaus.org/"&gt;Boo&lt;/a&gt;, it's one of Ayende's preferred languages.  Such tools as &lt;a href="http://www.ayende.com/Blog/archive/7268.aspx" mce_href="http://www.ayende.com/Blog/archive/7268.aspx"&gt;Binsor (The DSL for Windsor)&lt;/a&gt; were written in Boo.  If you're not familiar with the language, it has very similar syntax to Python and formats very nicely.  This easily fits Martin Fowler's category as an external DSL.  #Develop has some support for Boo to make it a first class language in the .NET family.  It also ships as part of the &lt;a href="http://castleproject.org/" mce_href="http://castleproject.org/"&gt;Castle Project&lt;/a&gt;.  Anyways, a quick sample of Binsor makes it look like a nice DSL for type registration in Castle Windsor in Boo Script:&lt;br /&gt;
&lt;br /&gt;
&lt;table width="100%" cellspacing="0" cellpadding="0" border="1" align="" summary=""&gt;
    &lt;tbody&gt;
        &lt;tr&gt;
            &lt;td&gt;  import Rhino.Commons&lt;br /&gt;
              logger = Component("console_logger", ILogger, ConsoleLogger)&lt;/td&gt;
        &lt;/tr&gt;
    &lt;/tbody&gt;
&lt;/table&gt;
&lt;br /&gt;
Check out the first chapter of Ayende's book which is available free online and explore it yourself for DSLs.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;DSLs in F#?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Another part that had me intrigued was the possibilities of not only Boo to do this, but F# as well.  &lt;a href="http://www.strangelights.com/blog/" mce_href="http://www.strangelights.com/blog/"&gt;Robert Pickering&lt;/a&gt; covers this in his book, &lt;a href="http://www.amazon.com/Foundations-F-Experts-Voice-Net/dp/1590597575" mce_href="http://www.amazon.com/Foundations-F-Experts-Voice-Net/dp/1590597575"&gt;Foundations of F#&lt;/a&gt;.  If you pay attention to Chapter 11, he covers DSLs in F# and gives a few examples of how you can do so.  To me, it's pretty powerful because you have a lot of the built-in features of a functional programming language such as lists, pattern matching and so on.  Such examples as given are such things as the arguments parser in F# that is described in the Arg class in Microsoft.FSharp.Compatibility.OCaml namespace.  This allows you to parse well known data structures as first class citizens.  Martin Fowler also gave such an example from the article I quoted from above.  F# lends itself quite well to DSLs in regard to support for lambda expressions.  &lt;br /&gt;
&lt;br /&gt;
Don Syme also covers these topics in his book &lt;a href="http://www.amazon.com/Expert-F-Experts-Voice-Net/dp/1590598504" mce_href="http://www.amazon.com/Expert-F-Experts-Voice-Net/dp/1590598504"&gt;Expert F#&lt;/a&gt; in Chapter 9.  This covers more language oriented programming techniques, but you can scan some information about building DSLs in F#.  Some interesting parts of this come down to Active Patterns which I covered partially yesterday.  In the coming weeks, I hope to post some of my forays into this, taking some samples from the Ruby community and applying some of the same functionality in F#.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Conclusion&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
There is still much yet to be covered in this topic of DSLs in .NET languages.  We can go on and on with regards to internal and external DSLs and argue about which language is suited for each.   But in the coming weeks, I hope to take some samples and show how they can apply cleanly in F#, and probably run into some language problems where it might not be the best fit.  But, that's the fun part about it. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/18/120624.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/18/120624.aspx" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120624"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120624" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/120624.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/03/18/120624.aspx</guid>
            <pubDate>Wed, 19 Mar 2008 00:43:44 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/120624.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/03/18/120624.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/120624.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/120624.aspx</trackback:ping>
        </item>
        <item>
            <title>Videos and Interviews from MIX08</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/03/10/120441.aspx</link>
            <description>Well, I've had the urge to find all the videos I could and watch them to find out all the goodies I missed while not at MIX08.  If you missed any of the main sessions, you can find out more about them &lt;a href="http://sessions.visitmix.com/"&gt;here&lt;/a&gt;.   Note that there are 88 sessions recorded here, so it's a lot of good viewing material.  &lt;br /&gt;
&lt;br /&gt;
Best of all are &lt;a href="http://www.hanselman.com/blog/"&gt;Scott Hanselman's&lt;/a&gt; MVC Videos can be seen &lt;a href="http://www.hanselman.com/blog/ASPNETMVCSessionAtMix08TDDAndMvcMockHelpers.aspx"&gt;here&lt;/a&gt;.  He also covers the MVC Mock Helpers which better allow for unit tests using various Mock frameworks including Rhino Mocks, TypeMock.NET and Moq. &lt;br /&gt;
&lt;a href="http://codebetter.com/blogs/david_laribee/"&gt;&lt;br /&gt;
Dave Laribee&lt;/a&gt; was great on Twitter to make sure we were all kept up to date with all the good things that were happening.  &lt;a href="http://codebetter.com/blogs/brendan.tompkins/"&gt;Brendan Tompkins&lt;/a&gt; supplied Dave with a video phone so that he could capture impromptu videos and such.  But, best of all they were broadcasted live.  He was able to talk to guys like &lt;a href="http://blog.wekeroad.com/"&gt;Rob Conery&lt;/a&gt;, &lt;a href="http://haacked.com/"&gt;Phil Haack&lt;/a&gt;, &lt;a href="http://stevenharman.net/"&gt;Steve Harman&lt;/a&gt;, &lt;a href="http://www.tirania.org/blog/"&gt;Miguel&lt;/a&gt;, &lt;a href="http://www.iunknown.com/"&gt;John Lam&lt;/a&gt;, &lt;a href="http://www.hanselman.com/blog/"&gt;Scott Hanselman&lt;/a&gt; and &lt;a href="http://www.joshholmes.com/"&gt;Josh Holmes&lt;/a&gt;.  Very cool stuff!  They were pretty good and entertaining, although the video wasn't always superb and sometimes you needed motion sickness pills.  But, the sessions of note are:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://qik.com/video/32308"&gt;Phil Haack interview&lt;/a&gt;&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://qik.com/video/32260"&gt;Capturing Hanselminutes&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://qik.com/video/31741"&gt;Rob Conery and Steve Harman interview&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://qik.com/video/31733"&gt;Miguel de Icaza interview&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://qik.com/video/31684"&gt;Pablo Castro interview&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://qik.com/video/31679"&gt;John Lam interview&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://qik.com/video/31678"&gt;Microsoft Surface demo&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://qik.com/video/31661"&gt;Josh Holmes interview&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
More of them can be found &lt;a href="http://qik.com/codebetter"&gt;here&lt;/a&gt;.  And it's enough to make Phil think that he has enough of a fidgeting problem...  Well, enjoy! &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/10/120441.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/10/120441.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120441"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120441" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/120441.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/03/10/120441.aspx</guid>
            <pubDate>Tue, 11 Mar 2008 00:21:46 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/120441.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/03/10/120441.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/120441.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/120441.aspx</trackback:ping>
        </item>
        <item>
            <title>IoC Container, Unity and Breaking Changes Galore</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/03/07/120336.aspx</link>
            <description>&lt;span style="font-weight: bold;"&gt;Update: &lt;a href="http://weblogs.asp.net/podwysocki/archive/2008/03/25/ioc-and-unity-the-basics-and-interception.aspx"&gt;IoC and Unity - The Basics and Interception&lt;/a&gt;&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
As &lt;a href="http://blogs.msdn.com/agile/"&gt;Grigori Melnik&lt;/a&gt; noted on my blog previously as well as his &lt;a href="http://blogs.msdn.com/agile/archive/2008/03/04/unity-project-heartbeat.aspx"&gt;own&lt;/a&gt;, there was a brand new drop of the &lt;a href="http://www.codeplex.com/unity"&gt;Unity Application Block&lt;/a&gt; as of &lt;a href="http://www.codeplex.com/unity/Release/ProjectReleases.aspx?ReleaseId=11319"&gt;March 4th&lt;/a&gt;.  This by far was a huge update with a lot of breaking changes.  That teaches me to use a CTP of any product and blog about it actively as it compares to other &lt;a href="http://en.wikipedia.org/wiki/Inversion_of_control"&gt;Inversion of Control (IoC)&lt;/a&gt; containers.  Glad I didn't do a lot on ASP.NET MVC just yet but I have a few good projects going on the side with that now.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Where I've Been Before&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
As noted here before, I've been spending some time actively comparing the Unity Application Block to other IoC containers and what each offers.  Let's get caught up to my previous posts:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/02/18/119744.aspx"&gt;IoC and the Unity Application Block&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/02/22/119911.aspx"&gt;IoC and the Unity Application Block - Going Deeper&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/02/26/120002.aspx"&gt;IoC and the Unity Application Block Once Again&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/03/04/120185.aspx"&gt;IoC Containers, Unity and ObjectBuilder2 - The Saga Continues&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
I'm probably going to change the code on each one just so that you all don't get angry about code from me not working, so stay tuned, it will get done.  But, keep in mind, it is still CTP, and I'd rather concentrate on the concepts as well.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;What's Changed&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
As you may notice if you did any of the code snippets I published, they sure as heck don't build anymore.  So, let's enumerate the changes made so far:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;UnityContainer method Register&amp;lt;TFrom, TTo&amp;gt;() becomes RegisterType&amp;lt;TFrom, TTo&amp;gt;()&lt;/li&gt;
    &lt;li&gt;UnityContainer method Get&amp;lt;T&amp;gt;() becomes Resolve&amp;lt;T&amp;gt;&lt;/li&gt;
    &lt;li&gt;UnityContainer method SetSingleton&amp;lt;T&amp;gt; removed&lt;/li&gt;
    &lt;li&gt;UnityContainer method RegisterType&amp;lt;TFrom, TTo&amp;gt; accepts a LifetimeManager to create Singletons&lt;/li&gt;
    &lt;li&gt;Added ContainerControlledLifetimeManager and ExternallyControlledLifetimeManager&lt;/li&gt;
    &lt;li&gt;Removed DependencyAttribute NotPresentBehavior property and enum&lt;/li&gt;
    &lt;li&gt;Added UnityContainer CreateChildContainer method to create child sandboxes&lt;/li&gt;
    &lt;li&gt;Reversed the parameters for UnityContainer method RegisterInstance&amp;lt;T&amp;gt;(value, key) to RegisterInstance&amp;lt;T&amp;gt;(key, value)&lt;/li&gt;
&lt;/ul&gt;
As you can see, some of these changes can be seen as quite annoying especially if I were to have a method such as the following and I can't find the error until I sit and read the code through and through:&lt;br /&gt;
&lt;br /&gt;
Old:&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red43\green145\blue175;\red255\green128\blue0;\red255\green255\blue0;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2             \cf3 IUnityContainer\cf1  container = \cf4 new\cf1  \cf5 UnityContainer\cf1 ();\par ??            container\par ??                .RegisterType&amp;lt;\cf3 ILogger\cf1 , \cf5 ConsoleLogger\cf1 &amp;gt;(\cf4 new\cf1  \cf5 ContainerControlledLifetimeManager\cf1 ())\par ??                .RegisterInstance&amp;lt;\cf4 string\cf1 &amp;gt;(\cf6 "defaultFromAddress"\cf1 , \cf6 "administrator@example.com"\cf1 );}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;IUnityContainer&lt;/span&gt; container = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;UnityContainer&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;container&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    .RegisterType&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;, &lt;span style="color: yellow;"&gt;ConsoleLogger&lt;/span&gt;&amp;gt;(&lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;ContainerControlledLifetimeManager&lt;/span&gt;())&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    .RegisterInstance&amp;lt;&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="color: lime;"&gt;"administrator@example.com"&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;/span&gt;&lt;span style="color: lime;"&gt;"defaultFromAddress"&lt;/span&gt;&lt;span style="color: lime;"&gt;&lt;/span&gt;);&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
And sure enough, it blew up due to the fact that it seemed just fine because it was RegisterInstance&amp;lt;string&amp;gt;(string, string) and instead I had to change it to this to get it to work.&lt;br /&gt;
&lt;br /&gt;
New:&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red43\green145\blue175;\red255\green128\blue0;\red255\green255\blue0;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2             \cf3 IUnityContainer\cf1  container = \cf4 new\cf1  \cf5 UnityContainer\cf1 ();\par ??            container\par ??                .RegisterType&amp;lt;\cf3 ILogger\cf1 , \cf5 ConsoleLogger\cf1 &amp;gt;(\cf4 new\cf1  \cf5 ContainerControlledLifetimeManager\cf1 ())\par ??                .RegisterInstance&amp;lt;\cf4 string\cf1 &amp;gt;(\cf6 "defaultFromAddress"\cf1 , \cf6 "administrator@example.com"\cf1 );}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;IUnityContainer&lt;/span&gt; container = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;UnityContainer&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;container&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    .RegisterType&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;, &lt;span style="color: yellow;"&gt;ConsoleLogger&lt;/span&gt;&amp;gt;(&lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;ContainerControlledLifetimeManager&lt;/span&gt;())&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    .RegisterInstance&amp;lt;&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="color: lime;"&gt;"defaultFromAddress"&lt;span style="color: rgb(255, 255, 255);"&gt;,&lt;/span&gt; &lt;/span&gt;&lt;span style="color: lime;"&gt;"administrator@example.com"&lt;span style="color: rgb(255, 255, 255);"&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: lime;"&gt;&lt;/span&gt;&lt;span style="color: lime;"&gt;&lt;/span&gt;);&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
Nothing from what I can tell changed in the XML configuration, but I prefer to register my types by code instead.  The only thing I really like to switch out from time to time is a Logger of some sort.&lt;br /&gt;
&lt;br /&gt;
Another interesting aspect is the concept of child containers in their own sandbox as it were.  Take for example, we have two loggers, a DebugLogger and a ConsoleLogger.  We have the ability to have these registered in two different child containers all managed by the parent.  Let's walk through a simple example of this.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 using\cf3  Microsoft.Practices.Unity;\par ??\par ??\cf1 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 class\cf3  \cf4 Program\par ??\cf3     \{\par ??        \cf1 static\cf3  \cf1 void\cf3  Main(\cf1 string\cf3 [] args)\par ??        \{\par ??            \cf4 UnityContainer\cf3  parentContainer = \cf1 new\cf3  \cf4 UnityContainer\cf3 ();\par ??            \cf5 IUnityContainer\cf3  childContainer1 = parentContainer.CreateChildContainer();\par ??            childContainer1.RegisterType&amp;lt;\cf5 ILogger\cf3 , \cf4 ConsoleLogger\cf3 &amp;gt;(\cf1 new\cf3  \cf4 ContainerControlledLifetimeManager\cf3 ());\par ??            \cf5 IUnityContainer\cf3  childContainer2 = parentContainer.CreateChildContainer();\par ??            childContainer2.RegisterType&amp;lt;\cf5 ILogger\cf3 , \cf4 DebugLogger\cf3 &amp;gt;(\cf1 new\cf3  \cf4 ContainerControlledLifetimeManager\cf3 ());\par ??\par ??            \cf5 ILogger\cf3  logger1 = childContainer1.Resolve&amp;lt;\cf5 ILogger\cf3 &amp;gt;();\par ??            \cf5 ILogger\cf3  logger2 = childContainer2.Resolve&amp;lt;\cf5 ILogger\cf3 &amp;gt;();\par ??            logger1.Log(\cf6 "Foo"\cf3 );\par ??            logger2.Log(\cf6 "Bar"\cf3 );\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Microsoft.Practices.Unity;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; UnitySamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;Program&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Main(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;UnityContainer&lt;/span&gt; parentContainer = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;UnityContainer&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;IUnityContainer&lt;/span&gt; childContainer1 = parentContainer.CreateChildContainer();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            childContainer1.RegisterType&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;, &lt;span style="color: yellow;"&gt;ConsoleLogger&lt;/span&gt;&amp;gt;(&lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;ContainerControlledLifetimeManager&lt;/span&gt;());&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;IUnityContainer&lt;/span&gt; childContainer2 = parentContainer.CreateChildContainer();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            childContainer2.RegisterType&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;, &lt;span style="color: yellow;"&gt;DebugLogger&lt;/span&gt;&amp;gt;(&lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;ContainerControlledLifetimeManager&lt;/span&gt;());&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt; logger1 = childContainer1.Resolve&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt; logger2 = childContainer2.Resolve&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            logger1.Log(&lt;span style="color: lime;"&gt;"Foo"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            logger2.Log(&lt;span style="color: lime;"&gt;"Bar"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
What seemed a little annoying to me is that CreateChildContainer is not available from the IUnityContainer, and instead only from the UnityContainer concrete class instead.  But as you can see, I create two loggers each in their own sandbox, one a DebugLogger and one the ConsoleLogger.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;What I'd Like To See&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
As I've said before, I'm not entirely sold on the Unity Application Block as I like a lot of the other ones in the Open Source Community as well including &lt;a href="http://www.castleproject.org/"&gt;Castle Windsor&lt;/a&gt;, &lt;a href="http://structuremap.sourceforge.net/"&gt;StructureMap&lt;/a&gt; and &lt;a href="http://www.springframework.net/"&gt;Spring.NET&lt;/a&gt;.  It's heartening that they are taking a lot of advice from the community to heart and having quick drops for public approval.  When people are evaluating IoC containers, it's critical that you have a list of essential features that the container must support.  You may also note that your needs for this may change from project to project, so don't assume that if it worked well here that it will suit your needs on all projects.  Due diligence must be done in tool and framework analysis to get the right tool for the right job.&lt;br /&gt;
&lt;br /&gt;
With that in mind, I have a few things that I'm looking for right now in an IoC container.  Some of these requirements are as follows:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;Must be lightweight (No heavy XML lifting required)&lt;/li&gt;
    &lt;li&gt;Must support interception and AOP with runtime weaving (compile time might be nice)&lt;/li&gt;
    &lt;li&gt;Should be opinionated so that I don't need to mark my dependencies in my constructor, instead match by name&lt;/li&gt;
    &lt;li&gt;When I ask for a logger, give me one and I don't care which&lt;/li&gt;
    &lt;li&gt;Support easy object registration through fluent interfaces&lt;/li&gt;
&lt;/ul&gt;
But like I said, it evolves quickly and changes from project to project.  What's your list and why?&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Further Thoughts About IoC&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://blogs.msdn.com/nickmalik/"&gt;Nick Malik&lt;/a&gt; recently blogged about IoC container and their overuse in a two part blog series &lt;a href="http://blogs.msdn.com/nickmalik/archive/2008/02/15/what-is-the-tradeoff-with-inversion-of-control-ioc.aspx"&gt;here&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/nickmalik/archive/2008/02/20/inversion-of-control-part-two.aspx"&gt;here&lt;/a&gt;.  In his first post, he tends to think that people are religious about the use of IoC containers and not just the &lt;a href="http://en.wikipedia.org/wiki/Dependency_Injection"&gt;Dependency Injection&lt;/a&gt; pattern in particular.  In the second post, he covers that the use of the IoC container is only as good as the team that understands its impact and applicability.  Most tools have their limits and uses.  Mocking containers have the same issue.  Once you start mocking for parts of your tests, then there is a good chance for abuse and overuse as well.  I see his point, but I disagree that many teams are not up for IoC containers and general good design practices of Dependency Injection.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Wrapping It Up&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Next time, I'd like to get into the extensibility model of each container in terms registering extensions and so on.  In the mean time, I hope you go and evaluate your needs for an IoC container, even whether you need one or not.  Until next time... &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/07/120336.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/07/120336.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120336"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120336" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/120336.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/03/07/120336.aspx</guid>
            <pubDate>Fri, 07 Mar 2008 08:13:25 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/120336.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/03/07/120336.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/120336.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/120336.aspx</trackback:ping>
        </item>
        <item>
            <title>Live From Mix08</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/03/05/120243.aspx</link>
            <description>No, I'm not at &lt;a href="http://visitmix.com/2008/default.aspx"&gt;Mix08&lt;/a&gt; right now, but I'm busy paying attention to every detail.  I'm missing a lot of really cool things such as:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;Silverlight downloads at 1.5 million a day&lt;/li&gt;
    &lt;li&gt;IE 8 preview with Firebug?&lt;br /&gt;
    &lt;/li&gt;
    &lt;li&gt;SQL Server Data Services&lt;/li&gt;
&lt;/ul&gt;
Also, now you can download IE8 already from &lt;a href="http://www.microsoft.com/windows/products/winfamily/ie/ie8/readiness/Install.htm"&gt;here&lt;/a&gt;, so the news just keeps coming...&lt;br /&gt;
&lt;br /&gt;
You can too by paying attention to the following places:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://www.visitmix.com/"&gt;Live streaming video&lt;/a&gt; from Mix from Microsoft and some short videos on:
    &lt;ul&gt;
        &lt;li&gt;IE 8&lt;/li&gt;
        &lt;li&gt;Scott Guthrie&lt;/li&gt;
        &lt;li&gt;Ray Ozzie&lt;/li&gt;
        &lt;li&gt;Dean Hachamovitch&lt;/li&gt;
    &lt;/ul&gt;
    &lt;/li&gt;
    &lt;li&gt;&lt;a href="http://qik.com/codebetter"&gt;CodeBetter's live stream&lt;/a&gt; by &lt;a href="http://codebetter.com/blogs/david_laribee/default.aspx"&gt;Dave Laribee&lt;/a&gt; which features short snippets from the event.&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.joshholmes.com/"&gt;Josh Holmes&lt;/a&gt; is covering the event and has noted about Ray Ozzie's keynote as well as other things.&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://www.iunknown.com/"&gt;John Lam&lt;/a&gt; will be at Mix as well and will be tweeting throughout the conference with his &lt;a href="http://twitter.com"&gt;Twitter &lt;/a&gt;name john_lam.  I know I'm following it now...&lt;/li&gt;
&lt;/ul&gt;
Also, if you're at Mix08, make sure you stop by to Josh Holmes's Open Spaces at Mix.  You can find out more details about it &lt;a href="http://www.joshholmes.com/2008/02/29/OpenSpaceMIX08.aspx"&gt;here&lt;/a&gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/05/120243.aspx"&gt;&lt;img border="0" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/05/120243.aspx" alt="kick it on DotNetKicks.com" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120243"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120243" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/120243.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/03/05/120243.aspx</guid>
            <pubDate>Wed, 05 Mar 2008 19:34:07 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/120243.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/03/05/120243.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/120243.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/120243.aspx</trackback:ping>
        </item>
        <item>
            <title>IoC Containers, Unity and ObjectBuilder2 - The Saga Continues</title>
            <link>http://geekswithblogs.net/Podwysocki/archive/2008/03/04/120185.aspx</link>
            <description>&lt;span style="font-weight: bold;"&gt;Update:  Fixed code changed from CTP and More in the series:&lt;/span&gt;&lt;br style="font-weight: bold;" /&gt;
&lt;ul style="font-weight: bold;"&gt;
    &lt;li&gt;&lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/03/07/120336.aspx"&gt;IoC Container, Unity and Breaking Changes Galore&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
I just wanted to revisit the whole &lt;a href="http://codeplex.com/unity"&gt;Unity Application Block&lt;/a&gt; just once more to look at a few more things including handling parameters, instances and so on.  If you hadn't seen, there was another source drop of Unity as of 2/26, so if you haven't picked it up, feel free to do so &lt;a mce_href="http://www.codeplex.com/unity/Release/ProjectReleases.aspx" href="http://www.codeplex.com/unity/Release/ProjectReleases.aspx"&gt;here&lt;/a&gt;.  &lt;br /&gt;
&lt;br /&gt;
So, we're going to continue our look at DI and IoC containers as they pertain to different needs.  I'm not going to be a gloryhound about any particular IoC container, instead, just lay out how each one does its job and you decide whether you want to use it or not.  And that's the main point I want to emphasize here that each tool has its purpose and its needs that it solves and it's up to you do decide whether it meets your needs and programming style.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Where We Are&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Anyhow, I covered the Unity Application Block in a few other posts lately as it relates to other Inversion of Control (IoC) containers.  I covered the basics with the Unity Application Block, &lt;a href="http://structuremap.sourceforge.net/"&gt;StructureMap &lt;/a&gt;and &lt;a href="http://www.castleproject.org/container/index.html"&gt;Castle Windsor&lt;/a&gt;.  Check them out before we go any further today:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/02/26/120002.aspx"&gt;IoC and the Unity Application Block&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/02/22/119911.aspx"&gt;IoC and the Unity Application Block - Going Deeper&lt;/a&gt;&lt;/li&gt;
    &lt;li&gt;&lt;a href="http://geekswithblogs.net/Podwysocki/archive/2008/02/26/120002.aspx"&gt;IoC and the Unity Application Block Once Again&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
Now that we're caught up to where we have been, let's dive into the other subjects in the same area of concern.  Unity has an interesting way of dealing with several issues that I want to cover in respect to other IoC containers.  And they are:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;Managing Instances and Parameters&lt;/li&gt;
    &lt;li&gt;Method Call Injection&lt;/li&gt;
    &lt;li&gt;Unity Application Block versus ObjectBuilder2&lt;/li&gt;
&lt;/ul&gt;
&lt;span style="font-weight: bold;"&gt;Managing Instances or Parameters?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The previous two times, we talked about constructor injection and setter injection, but not really about managing simple types and mapping them to our constructors.  It's usually a simple thing, but yet, we have three different ways of attacking the very same problem.  That's the very point of these blog posts to point that out and it's once again echoed here.&lt;br /&gt;
&lt;br /&gt;
To set up this scenario, we have a simple SmtpEmailService which is used to send emails to users in our system.  It's a pretty naive sample, yet will illustrate some simple constructor injection with both simple and complex types.  We're going to inject a default from address and a logger into our service and go from there.&lt;br /&gt;
&lt;br /&gt;
We'll start with our Unity sample of how we are going to map those simple and complex types to the constructor.  Let's start off with the basic logger interface and implementation.  I'll only post this part once as it will apply the same to each of the samples.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red43\green145\blue175;}??\fs16 \cf1\cb2\highlight2 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 public\cf3  \cf1 interface\cf3  \cf4 ILogger\par ??\cf3     \{\par ??        \cf1 void\cf3  Log(\cf1 string\cf3  message);\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; UnitySamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;interface&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Log(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; message);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
And once again, we have our concrete implementation with the console logger.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;}??\fs16 \cf1\cb2\highlight2 using\cf3  System;\par ??\par ??\cf1 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 public\cf3  \cf1 class\cf3  \cf4 ConsoleLogger\cf3  : \cf5 ILogger\par ??\cf3     \{\par ??        \cf1 public\cf3  \cf1 void\cf3  Log(\cf1 string\cf3  message)\par ??        \{\par ??            \cf4 Console\cf3 .WriteLine(message);\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; System;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; UnitySamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;ConsoleLogger&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Log(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; message)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;Console&lt;/span&gt;.WriteLine(message);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
Now, let's tie it together with the point of today's post, the SmtpEmailService.  We will have two parameters in this scenario, the default email address, and the logger used for logging.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 using\cf3  Microsoft.Practices.Unity;\par ??\par ??\cf1 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 public\cf3  \cf1 class\cf3  \cf4 SmtpEmailService\cf3  : \cf5 IEmailService\par ??\cf3     \{\par ??        \cf1 private\cf3  \cf1 readonly\cf3  \cf1 string\cf3  defaultFromAddress;\par ??        \cf1 private\cf3  \cf1 readonly\cf3  \cf5 ILogger\cf3  logger;\par ??\par ??        \cf1 public\cf3  SmtpEmailService([\cf4 Dependency\cf3 (\cf6 "defaultFromAddress"\cf3 )] \cf1 string\cf3  defaultFromAddress, \cf5 ILogger\cf3  logger)\par ??        \{\par ??            \cf1 this\cf3 .defaultFromAddress = defaultFromAddress;\par ??            \cf1 this\cf3 .logger = logger;\par ??        \}\par ??\par ??        \cf1 public\cf3  \cf1 void\cf3  SendEmail(\cf1 string\cf3  to, \cf1 string\cf3  subject, \cf1 string\cf3  body)\par ??        \{\par ??            \cf6 // Send email\par ??\cf3             logger.Log(\cf1 string\cf3 .Format(\cf6 "Sending email from \{0\} to \{1\} with the subject \{2\} and body \{3\}"\cf3 , defaultFromAddress, to, subject, body));\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Microsoft.Practices.Unity;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; UnitySamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;IEmailService&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;readonly&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; defaultFromAddress;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;readonly&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt; logger;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; SmtpEmailService([&lt;span style="color: yellow;"&gt;Dependency&lt;/span&gt;(&lt;span style="color: lime;"&gt;"defaultFromAddress"&lt;/span&gt;)] &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; defaultFromAddress, &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt; logger)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;this&lt;/span&gt;.defaultFromAddress = defaultFromAddress;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;this&lt;/span&gt;.logger = logger;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; SendEmail(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; to, &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; subject, &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; body)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: lime;"&gt;// Send email&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            logger.Log(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: lime;"&gt;"Sending email from {0} to {1} with the subject {2} and body {3}"&lt;/span&gt;, defaultFromAddress, to, subject, body));&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
As you may note, I'm using the DependencyAttribute to decorate the parameter defaultFromAddress.  This correlates to the key specified in the config file or when you register an instance, and I'll show you that later.   &lt;br /&gt;
Let's take a look at the program.cs to use the XML config file to wire up our instances.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 using\cf3  System.Configuration;\par ??\par ??\cf1 using\cf3  Microsoft.Practices.Unity;\par ??\cf1 using\cf3  Microsoft.Practices.Unity.Configuration;\par ??\par ??\cf1 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 class\cf3  \cf4 Program\par ??\cf3     \{\par ??        \cf1 static\cf3  \cf1 void\cf3  Main(\cf1 string\cf3 [] args)\par ??        \{\par ??            \cf5 IUnityContainer\cf3  container = \cf1 new\cf3  \cf4 UnityContainer\cf3 ();\par ??            \cf4 UnityConfigurationSection\cf3  section = (\cf4 UnityConfigurationSection\cf3 )\cf4 ConfigurationManager\cf3 .GetSection(\cf6 "unity"\cf3 );\par ??            section.Containers.Default.GetConfigCommand().Configure(container);\par ??            \cf4 SmtpEmailService\cf3  service = container.Get&amp;lt;\cf4 SmtpEmailService\cf3 &amp;gt;();\par ??            service.SendEmail(\cf6 "me@example.com"\cf3 , \cf6 "Test email"\cf3 , \cf6 "This is a test email"\cf3 );\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; System.Configuration;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Microsoft.Practices.Unity;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Microsoft.Practices.Unity.Configuration;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; UnitySamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;Program&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Main(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;IUnityContainer&lt;/span&gt; container = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;UnityContainer&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;UnityConfigurationSection&lt;/span&gt; section = (&lt;span style="color: yellow;"&gt;UnityConfigurationSection&lt;/span&gt;)&lt;span style="color: yellow;"&gt;ConfigurationManager&lt;/span&gt;.GetSection(&lt;span style="color: lime;"&gt;"unity"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            section.Containers.Default.GetConfigCommand().Configure(container);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt; service = container.Resolve&amp;lt;&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            service.SendEmail(&lt;span style="color: lime;"&gt;"me@example.com"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"Test email"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"This is a test email"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
The above code is pretty standard as we've used before, so real surprises here.  So, let's take a look at the XML configuration necessary to make this work:&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red255\green128\blue0;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 &amp;lt;?xml \cf3 version\cf1 ="\cf4 1.0\cf1 " \cf3 encoding\cf1 ="\cf4 utf-8\cf1 " ?&amp;gt;\par ??&amp;lt;configuration&amp;gt;\par ??\tab &amp;lt;configSections&amp;gt;\par ??\tab \tab &amp;lt;section \cf3 name\cf1 ="\cf4 unity\cf1 "\par ??\tab \tab \tab \tab \cf3 type\cf1 ="\cf4 Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,\par ??                  Microsoft.Practices.Unity.Configuration\cf1 " /&amp;gt;\par ??\tab &amp;lt;/configSections&amp;gt;\par ??\tab &amp;lt;unity&amp;gt;\par ??\tab \tab &amp;lt;containers&amp;gt;\par ??\tab \tab \tab &amp;lt;container&amp;gt;\par ??\tab \tab \tab \tab &amp;lt;types&amp;gt;\par ??\tab \tab \tab \tab \tab &amp;lt;type \cf3 type\cf1 ="\cf4 UnitySamples.ILogger,UnitySamples\cf1 "\par ??\tab \tab \tab \tab \tab \tab   \cf3 mapTo\cf1 ="\cf4 UnitySamples.ConsoleLogger,UnitySamples\cf1 "\par ??\tab \tab \tab \tab \tab \tab   \cf3 lifetime\cf1 ="\cf4 Singleton\cf1 "/&amp;gt;\par ??\tab \tab \tab \tab &amp;lt;/types&amp;gt;\par ??\tab \tab \tab \tab &amp;lt;instances&amp;gt;\par ??\tab \tab \tab \tab \tab &amp;lt;add \cf3 name\cf1 ="\cf4 defaultFromAddress\cf1 " \cf3 type\cf1 ="\cf4 System.String\cf1 " \cf3 value\cf1 ="\cf4 administrator@example.com\cf1 " /&amp;gt;\par ??\tab \tab \tab \tab &amp;lt;/instances&amp;gt;\par ??\tab \tab \tab &amp;lt;/container&amp;gt;\par ??\tab \tab &amp;lt;/containers&amp;gt;\par ??\tab &amp;lt;/unity&amp;gt;\par ??&amp;lt;/configuration&amp;gt;\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&amp;lt;?xml &lt;span style="color: rgb(255, 128, 0);"&gt;version&lt;/span&gt;="&lt;span style="color: lime;"&gt;1.0&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;encoding&lt;/span&gt;="&lt;span style="color: lime;"&gt;utf-8&lt;/span&gt;" ?&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;lt;configuration&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;configSections&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &amp;lt;section &lt;span style="color: rgb(255, 128, 0);"&gt;name&lt;/span&gt;="&lt;span style="color: lime;"&gt;unity&lt;/span&gt;"&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(255, 128, 0);"&gt;type&lt;/span&gt;="&lt;span style="color: lime;"&gt;Microsoft.Practices.Unity.Configuration.UnityConfigurationSection,&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: lime;"&gt;                  Microsoft.Practices.Unity.Configuration&lt;/span&gt;" /&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;/configSections&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;unity&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &amp;lt;containers&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &amp;lt;container&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &amp;lt;types&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                    &amp;lt;type &lt;span style="color: rgb(255, 128, 0);"&gt;type&lt;/span&gt;="&lt;span style="color: lime;"&gt;UnitySamples.ILogger,UnitySamples&lt;/span&gt;"&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                          &lt;span style="color: rgb(255, 128, 0);"&gt;mapTo&lt;/span&gt;="&lt;span style="color: lime;"&gt;UnitySamples.ConsoleLogger,UnitySamples&lt;/span&gt;"&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                          &lt;span style="color: rgb(255, 128, 0);"&gt;lifetime&lt;/span&gt;="&lt;span style="color: lime;"&gt;Singleton&lt;/span&gt;"/&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &amp;lt;/types&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &amp;lt;instances&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                    &amp;lt;add &lt;span style="color: rgb(255, 128, 0);"&gt;name&lt;/span&gt;="&lt;span style="color: lime;"&gt;defaultFromAddress&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;type&lt;/span&gt;="&lt;span style="color: lime;"&gt;System.String&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;value&lt;/span&gt;="&lt;span style="color: lime;"&gt;administrator@example.com&lt;/span&gt;" /&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &amp;lt;/instances&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &amp;lt;/container&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &amp;lt;/containers&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;/unity&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;lt;/configuration&amp;gt;&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
What I did is that I utilized the instances node and then add an instance called defaultFromAddress.  This node is only used to initialize simple types such as strings, DateTimes, System.Doubles, System.Int32 and so on.  Then I can set the value as well.  So, if I want to initialize complex types in the types node and the simple types in the instances node.&lt;br /&gt;
&lt;br /&gt;
But, we can also register things through the regular programmatic interfaces as well such as this:&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 using\cf3  Microsoft.Practices.Unity;\par ??\par ??\cf1 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 class\cf3  \cf4 Program\par ??\cf3     \{\par ??        \cf1 static\cf3  \cf1 void\cf3  Main(\cf1 string\cf3 [] args)\par ??        \{\par ??            \cf5 IUnityContainer\cf3  container = \cf1 new\cf3  \cf4 UnityContainer\cf3 ();\par ??            container\par ??                .Register&amp;lt;\cf5 ILogger\cf3 , \cf4 ConsoleLogger\cf3 &amp;gt;()\par ??                .SetSingleton&amp;lt;\cf5 ILogger\cf3 &amp;gt;()\par ??                .RegisterInstance&amp;lt;\cf1 string\cf3 &amp;gt;(\cf6 "administrator@example.com"\cf3 , \cf6 "defaultFromAddress"\cf3 );\par ??\par ??\par ??            \cf6 //UnityConfigurationSection section = (UnityConfigurationSection)ConfigurationManager.GetSection("unity");\par ??\cf3             \cf6 //section.Containers.Default.GetConfigCommand().Configure(container);\par ??\cf3             \cf4 SmtpEmailService\cf3  service = container.Get&amp;lt;\cf4 SmtpEmailService\cf3 &amp;gt;();\par ??            service.SendEmail(\cf6 "me@example.com"\cf3 , \cf6 "Test email"\cf3 , \cf6 "This is a test email"\cf3 );\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Microsoft.Practices.Unity;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; UnitySamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;Program&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Main(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(43, 145, 175);"&gt;IUnityContainer&lt;/span&gt; container = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;UnityContainer&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            container&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                .Register&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;, &lt;span style="color: yellow;"&gt;ConsoleLogger&lt;/span&gt;&amp;gt;(&lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;ContainerControlledLifetimeManager&lt;/span&gt;())&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                .RegisterInstance&amp;lt;&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;&amp;gt;(&lt;span style="color: lime;"&gt;"administrator@example.com"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"defaultFromAddress"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt; service = container.Resolve&amp;lt;&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            service.SendEmail(&lt;span style="color: lime;"&gt;"me@example.com"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"Test email"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"This is a test email"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
As you note, I used the fluent interfaces approach to register the ConsoleLogger as well as the instance of type string which had my value and the key I wanted to use.  The first value I use is the value, and the second is the key I want to use to correlate to my DependencyAttribute.&lt;br /&gt;
&lt;br /&gt;
Now, let's look at the StructureMap instance using the same approach.  The only pieces I intend to show are just the pieces I changed.  So, let's take a look at the SmtpEmailService once again.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 namespace\cf3  StructureMapSamples\par ??\{\par ??    \cf1 public\cf3  \cf1 class\cf3  \cf4 SmtpEmailService\cf3  : \cf5 IEmailService\par ??\cf3     \{\par ??        \cf1 private\cf3  \cf1 readonly\cf3  \cf1 string\cf3  defaultFromAddress;\par ??        \cf1 private\cf3  \cf1 readonly\cf3  \cf5 ILogger\cf3  logger;\par ??\par ??        \cf1 public\cf3  SmtpEmailService(\cf1 string\cf3  defaultFromAddress, \cf5 ILogger\cf3  logger)\par ??        \{\par ??            \cf1 this\cf3 .defaultFromAddress = defaultFromAddress;\par ??            \cf1 this\cf3 .logger = logger;\par ??        \}\par ??\par ??        \cf1 public\cf3  \cf1 void\cf3  SendEmail(\cf1 string\cf3  to, \cf1 string\cf3  subject, \cf1 string\cf3  body)\par ??        \{\par ??            \cf6 // Send email\par ??\cf3             logger.Log(\cf1 string\cf3 .Format(\cf6 "Sending email from \{0\} to \{1\} with the subject \{2\} and body \{3\}"\cf3 , defaultFromAddress, to, subject, body));\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; StructureMapSamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;IEmailService&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;readonly&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; defaultFromAddress;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;readonly&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt; logger;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; SmtpEmailService(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; defaultFromAddress, &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt; logger)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;this&lt;/span&gt;.defaultFromAddress = defaultFromAddress;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;this&lt;/span&gt;.logger = logger;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; SendEmail(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; to, &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; subject, &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; body)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: lime;"&gt;// Send email&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            logger.Log(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: lime;"&gt;"Sending email from {0} to {1} with the subject {2} and body {3}"&lt;/span&gt;, defaultFromAddress, to, subject, body));&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
As you may note from above, I had no need for the dependency attribute or anything like that.  I haven't bothered to put the PluginAttributes or anything like that either as I want to do XML config way.  So, let's next look at the program.cs which does the simple email wireup.  &lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 using\cf3  StructureMap;\par ??\par ??\cf1 namespace\cf3  StructureMapSamples\par ??\{\par ??    \cf1 class\cf3  \cf4 Program\par ??\cf3     \{\par ??        \cf1 static\cf3  \cf1 void\cf3  Main(\cf1 string\cf3 [] args)\par ??        \{\par ??            \cf4 SmtpEmailService\cf3  service = \cf4 ObjectFactory\cf3 .GetInstance&amp;lt;\cf4 SmtpEmailService\cf3 &amp;gt;();\par ??            service.SendEmail(\cf5 "me@example.com"\cf3 , \cf5 "Test email"\cf3 , \cf5 "This is a test email"\cf3 );\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; StructureMap;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; StructureMapSamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;Program&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Main(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt; service = &lt;span style="color: yellow;"&gt;ObjectFactory&lt;/span&gt;.GetInstance&amp;lt;&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            service.SendEmail(&lt;span style="color: lime;"&gt;"me@example.com"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"Test email"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"This is a test email"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
And then we wire things up with our StructureMap.config file.  Note that we set up things through an Instance node and then set the constructor injection parameters through property nodes.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red255\green128\blue0;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 &amp;lt;?xml \cf3 version\cf1 ="\cf4 1.0\cf1 " \cf3 encoding\cf1 ="\cf4 utf-8\cf1 " ?&amp;gt;\par ??&amp;lt;StructureMap&amp;gt;\par ??\tab &amp;lt;Aseembly \cf3 Name\cf1 ="\cf4 StructureMapSamples\cf1 "/&amp;gt;\par ??  &amp;lt;PluginFamily \cf3 Type\cf1 ="\cf4 StructureMapSamples.ILogger\cf1 " \cf3 Assembly\cf1 ="\cf4 StructureMapSamples\cf1 " \cf3 DefaultKey\cf1 ="\cf4 Console\cf1 " \cf3 Scope\cf1 ="\cf4 Singleton\cf1 "&amp;gt;\par ??    &amp;lt;Plugin \cf3 Assembly\cf1 ="\cf4 StructureMapSamples\cf1 " \cf3 Type\cf1 ="\cf4 StructureMapSamples.ConsoleLogger\cf1 " \cf3 ConcreteKey\cf1 ="\cf4 Console\cf1 " /&amp;gt;\par ??    &amp;lt;/PluginFamily&amp;gt;\par ??  &amp;lt;PluginFamily \cf3 Type\cf1 ="\cf4 StructureMapSamples.SmtpEmailService\cf1 " \cf3 Assembly\cf1 ="\cf4 StructureMapSamples\cf1 " \cf3 DefaultKey\cf1 ="\cf4 EmailService\cf1 "&amp;gt;\par ??\tab   &amp;lt;Plugin \cf3 Assembly\cf1 ="\cf4 StructureMapSamples\cf1 " \cf3 Type\cf1 ="\cf4 StructureMapSamples.SmtpEmailService\cf1 " \cf3 ConcreteKey\cf1 ="\cf4 SmtpEmailService\cf1 " /&amp;gt;\par ??\tab   &amp;lt;Instance \cf3 Key\cf1 ="\cf4 EmailService\cf1 " \cf3 Type\cf1 ="\cf4 SmtpEmailService\cf1 "&amp;gt;\par ??\tab \tab   &amp;lt;Property \cf3 Name\cf1 ="\cf4 defaultFromAddress\cf1 " \cf3 Value\cf1 ="\cf4 administrator@example.com\cf1 " /&amp;gt;\par ??\tab \tab   &amp;lt;Property \cf3 Name\cf1 ="\cf4 logger\cf1 " \cf3 Key\cf1 ="\cf4 Console\cf1 " /&amp;gt;\par ??\tab   &amp;lt;/Instance&amp;gt;\par ??  &amp;lt;/PluginFamily&amp;gt;\par ??&amp;lt;/StructureMap&amp;gt;}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&amp;lt;?xml &lt;span style="color: rgb(255, 128, 0);"&gt;version&lt;/span&gt;="&lt;span style="color: lime;"&gt;1.0&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;encoding&lt;/span&gt;="&lt;span style="color: lime;"&gt;utf-8&lt;/span&gt;" ?&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;lt;StructureMap&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;Aseembly &lt;span style="color: rgb(255, 128, 0);"&gt;Name&lt;/span&gt;="&lt;span style="color: lime;"&gt;StructureMapSamples&lt;/span&gt;"/&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;  &amp;lt;PluginFamily &lt;span style="color: rgb(255, 128, 0);"&gt;Type&lt;/span&gt;="&lt;span style="color: lime;"&gt;StructureMapSamples.ILogger&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;Assembly&lt;/span&gt;="&lt;span style="color: lime;"&gt;StructureMapSamples&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;DefaultKey&lt;/span&gt;="&lt;span style="color: lime;"&gt;Console&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;Scope&lt;/span&gt;="&lt;span style="color: lime;"&gt;Singleton&lt;/span&gt;"&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;Plugin &lt;span style="color: rgb(255, 128, 0);"&gt;Assembly&lt;/span&gt;="&lt;span style="color: lime;"&gt;StructureMapSamples&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;Type&lt;/span&gt;="&lt;span style="color: lime;"&gt;StructureMapSamples.ConsoleLogger&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;ConcreteKey&lt;/span&gt;="&lt;span style="color: lime;"&gt;Console&lt;/span&gt;" /&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;/PluginFamily&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;  &amp;lt;PluginFamily &lt;span style="color: rgb(255, 128, 0);"&gt;Type&lt;/span&gt;="&lt;span style="color: lime;"&gt;StructureMapSamples.SmtpEmailService&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;Assembly&lt;/span&gt;="&lt;span style="color: lime;"&gt;StructureMapSamples&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;DefaultKey&lt;/span&gt;="&lt;span style="color: lime;"&gt;EmailService&lt;/span&gt;"&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;      &amp;lt;Plugin &lt;span style="color: rgb(255, 128, 0);"&gt;Assembly&lt;/span&gt;="&lt;span style="color: lime;"&gt;StructureMapSamples&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;Type&lt;/span&gt;="&lt;span style="color: lime;"&gt;StructureMapSamples.SmtpEmailService&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;ConcreteKey&lt;/span&gt;="&lt;span style="color: lime;"&gt;SmtpEmailService&lt;/span&gt;" /&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;      &amp;lt;Instance &lt;span style="color: rgb(255, 128, 0);"&gt;Key&lt;/span&gt;="&lt;span style="color: lime;"&gt;EmailService&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;Type&lt;/span&gt;="&lt;span style="color: lime;"&gt;SmtpEmailService&lt;/span&gt;"&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;          &amp;lt;Property &lt;span style="color: rgb(255, 128, 0);"&gt;Name&lt;/span&gt;="&lt;span style="color: lime;"&gt;defaultFromAddress&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;Value&lt;/span&gt;="&lt;span style="color: lime;"&gt;administrator@example.com&lt;/span&gt;" /&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;          &amp;lt;Property &lt;span style="color: rgb(255, 128, 0);"&gt;Name&lt;/span&gt;="&lt;span style="color: lime;"&gt;logger&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;Key&lt;/span&gt;="&lt;span style="color: lime;"&gt;Console&lt;/span&gt;" /&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;      &amp;lt;/Instance&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;  &amp;lt;/PluginFamily&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;lt;/StructureMap&amp;gt;&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
I tidied up the XML configuration a bit after taking Jeremy Miller's advice and trying to collapse it down as much as possible.  I'm sure I still don't have it to the smallest amount possible, but at least it's legible.  Now, let's go ahead and use the DSL for configuration instead of the simple program.cs we have above.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 using\cf3  StructureMap;\par ??\cf1 using\cf3  StructureMap.Configuration.DSL;\par ??\par ??\cf1 namespace\cf3  StructureMapSamples\par ??\{\par ??    \cf1 class\cf3  \cf4 Program\par ??\cf3     \{\par ??        \cf1 static\cf3  \cf1 void\cf3  Main(\cf1 string\cf3 [] args)\par ??        \{\par ??            \cf4 StructureMapConfiguration\cf3 .UseDefaultStructureMapConfigFile = \cf1 false\cf3 ;\par ??            \cf4 StructureMapConfiguration\cf3 .BuildInstancesOf&amp;lt;\cf5 ILogger\cf3 &amp;gt;()\par ??                .TheDefaultIsConcreteType&amp;lt;\cf4 ConsoleLogger\cf3 &amp;gt;().AsSingletons();\par ??            \cf4 StructureMapConfiguration\cf3 .BuildInstancesOf&amp;lt;\cf4 SmtpEmailService\cf3 &amp;gt;().TheDefaultIs(\par ??                \cf4 Registry\cf3 .Instance&amp;lt;\cf4 SmtpEmailService\cf3 &amp;gt;().UsingConcreteType&amp;lt;\cf4 SmtpEmailService\cf3 &amp;gt;()\par ??                    .WithProperty(\cf6 "defaultFromAddress"\cf3 ).EqualTo(\cf6 "administrator@example.com"\cf3 ));\par ??            \cf4 SmtpEmailService\cf3  service = \cf4 ObjectFactory\cf3 .GetInstance&amp;lt;\cf4 SmtpEmailService\cf3 &amp;gt;();\par ??            service.SendEmail(\cf6 "me@example.com"\cf3 , \cf6 "Test email"\cf3 , \cf6 "This is a test email"\cf3 );\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; StructureMap;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; StructureMap.Configuration.DSL;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; StructureMapSamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;Program&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Main(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;StructureMapConfiguration&lt;/span&gt;.UseDefaultStructureMapConfigFile = &lt;span style="color: rgb(255, 128, 0);"&gt;false&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;StructureMapConfiguration&lt;/span&gt;.BuildInstancesOf&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;&amp;gt;()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                .TheDefaultIsConcreteType&amp;lt;&lt;span style="color: yellow;"&gt;ConsoleLogger&lt;/span&gt;&amp;gt;().AsSingletons();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;StructureMapConfiguration&lt;/span&gt;.BuildInstancesOf&amp;lt;&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;&amp;gt;().TheDefaultIs(&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Registry&lt;/span&gt;.Instance&amp;lt;&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;&amp;gt;().UsingConcreteType&amp;lt;&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;&amp;gt;()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                    .WithProperty(&lt;span style="color: lime;"&gt;"defaultFromAddress"&lt;/span&gt;).EqualTo(&lt;span style="color: lime;"&gt;"administrator@example.com"&lt;/span&gt;));&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt; service = &lt;span style="color: yellow;"&gt;ObjectFactory&lt;/span&gt;.GetInstance&amp;lt;&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            service.SendEmail(&lt;span style="color: lime;"&gt;"me@example.com"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"Test email"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"This is a test email"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
As you can see from above, it's a pretty simple thing to use the more fluent interfaces here as well to register what we're interested in.  We're making sure it doesn't use the default StructureMap.config file and then build up an instance of an ILogger as a singleton, and then use the injection on the SmtpService to set the defaultFromAddress.  The ILogger it should automatically figure out itself.&lt;br /&gt;
&lt;br /&gt;
Now, let's finally move onto Castle Windsor.  I must admit, I'm most familiar with Castle Windsor, but I'm learning something new about each of these every day, which is a good thing.  So, the only classes I really need to show is the program.cs and the configuration file to show what has changed.  So, let's start with the program.cs file:&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 using\cf3  Castle.Windsor;\par ??\cf1 using\cf3  Castle.Windsor.Configuration.Interpreters;\par ??\par ??\cf1 namespace\cf3  CastleSamples\par ??\{\par ??    \cf1 class\cf3  \cf4 Program\par ??\cf3     \{\par ??        \cf1 static\cf3  \cf1 void\cf3  Main(\cf1 string\cf3 [] args)\par ??        \{\par ??            \cf4 WindsorContainer\cf3  container = \cf1 new\cf3  \cf4 WindsorContainer\cf3 (\cf1 new\cf3  \cf4 XmlInterpreter\cf3 ());\par ??            \cf4 SmtpEmailService\cf3  service = container.Resolve&amp;lt;\cf4 SmtpEmailService\cf3 &amp;gt;();\par ??            service.SendEmail(\cf5 "me@example.com"\cf3 , \cf5 "Test email"\cf3 , \cf5 "This is a test email"\cf3 );\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Castle.Windsor;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Castle.Windsor.Configuration.Interpreters;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; CastleSamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;Program&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Main(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;WindsorContainer&lt;/span&gt; container = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;WindsorContainer&lt;/span&gt;(&lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;XmlInterpreter&lt;/span&gt;());&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt; service = container.Resolve&amp;lt;&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            service.SendEmail(&lt;span style="color: lime;"&gt;"me@example.com"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"Test email"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"This is a test email"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
This is a pretty simple example of using the XmlInterpreter which reads the XML configuration file to read what we want to set.  And then our XML configuration file should look something like this:&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red255\green128\blue0;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 &amp;lt;?xml \cf3 version\cf1 ="\cf4 1.0\cf1 " \cf3 encoding\cf1 ="\cf4 utf-8\cf1 " ?&amp;gt;\par ??&amp;lt;configuration&amp;gt;\par ??\tab &amp;lt;configSections&amp;gt;\par ??\tab \tab &amp;lt;section \cf3 name\cf1 ="\cf4 castle\cf1 "\par ??\tab \tab \tab \cf3 type\cf1 ="\cf4 Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor\cf1 " /&amp;gt;\par ??\tab &amp;lt;/configSections&amp;gt;\par ??\tab &amp;lt;castle&amp;gt;\par ??\tab \tab &amp;lt;components&amp;gt;\par ??\tab \tab \tab &amp;lt;component \cf3 id\cf1 ="\cf4 emailservice.smtp\cf1 "\par ??\tab \tab \tab \tab \cf3 type\cf1 ="\cf4 CastleSamples.SmtpEmailService, CastleSamples\cf1 "&amp;gt;\par ??\tab \tab \tab &amp;lt;parameters&amp;gt;\par ??\tab \tab \tab \tab &amp;lt;defaultFromAddress&amp;gt;administrator@example.com&amp;lt;/defaultFromAddress&amp;gt;\par ??\tab \tab \tab &amp;lt;/parameters&amp;gt;\par ??\tab \tab &amp;lt;/component&amp;gt;\par ??\tab \tab &amp;lt;component \cf3 id\cf1 ="\cf4 logger.console\cf1 "\par ??\tab \tab \tab \tab \tab    \cf3 service\cf1 ="\cf4 CastleSamples.ILogger, CastleSamples\cf1 "\par ??\tab \tab \tab \tab \tab    \cf3 type\cf1 ="\cf4 CastleSamples.ConsoleLogger, CastleSamples\cf1 "\par ??\tab \tab \tab \tab \tab    \cf3 lifestyle\cf1 ="\cf4 singleton\cf1 " /&amp;gt;\par ??\tab \tab &amp;lt;/components&amp;gt;\par ??\tab &amp;lt;/castle&amp;gt;\par ??&amp;lt;/configuration&amp;gt;\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&amp;lt;?xml &lt;span style="color: rgb(255, 128, 0);"&gt;version&lt;/span&gt;="&lt;span style="color: lime;"&gt;1.0&lt;/span&gt;" &lt;span style="color: rgb(255, 128, 0);"&gt;encoding&lt;/span&gt;="&lt;span style="color: lime;"&gt;utf-8&lt;/span&gt;" ?&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;lt;configuration&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;configSections&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &amp;lt;section &lt;span style="color: rgb(255, 128, 0);"&gt;name&lt;/span&gt;="&lt;span style="color: lime;"&gt;castle&lt;/span&gt;"&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;type&lt;/span&gt;="&lt;span style="color: lime;"&gt;Castle.Windsor.Configuration.AppDomain.CastleSectionHandler, Castle.Windsor&lt;/span&gt;" /&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;/configSections&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;castle&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &amp;lt;components&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &amp;lt;component &lt;span style="color: rgb(255, 128, 0);"&gt;id&lt;/span&gt;="&lt;span style="color: lime;"&gt;emailservice.smtp&lt;/span&gt;"&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(255, 128, 0);"&gt;type&lt;/span&gt;="&lt;span style="color: lime;"&gt;CastleSamples.SmtpEmailService, CastleSamples&lt;/span&gt;"&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &amp;lt;parameters&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &amp;lt;defaultFromAddress&amp;gt;administrator@example.com&amp;lt;/defaultFromAddress&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &amp;lt;/parameters&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &amp;lt;/component&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &amp;lt;component &lt;span style="color: rgb(255, 128, 0);"&gt;id&lt;/span&gt;="&lt;span style="color: lime;"&gt;logger.console&lt;/span&gt;"&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                       &lt;span style="color: rgb(255, 128, 0);"&gt;service&lt;/span&gt;="&lt;span style="color: lime;"&gt;CastleSamples.ILogger, CastleSamples&lt;/span&gt;"&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                       &lt;span style="color: rgb(255, 128, 0);"&gt;type&lt;/span&gt;="&lt;span style="color: lime;"&gt;CastleSamples.ConsoleLogger, CastleSamples&lt;/span&gt;"&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                       &lt;span style="color: rgb(255, 128, 0);"&gt;lifestyle&lt;/span&gt;="&lt;span style="color: lime;"&gt;singleton&lt;/span&gt;" /&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &amp;lt;/components&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &amp;lt;/castle&amp;gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&amp;lt;/configuration&amp;gt;&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
I could have also specified the logger as well as a parameter by noting it inside the parameters node such as this:&lt;br /&gt;
&amp;lt;logger&amp;gt;${logger.console}&amp;lt;/logger&amp;gt; to specify that it uses the ConsoleLogger, but it's not really necessary to do so.&lt;br /&gt;
&lt;br /&gt;
Instead, let's use the XML free way of configuration just to prove a point we can do it both ways:&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red0\green255\blue0;\red43\green145\blue175;}??\fs16 \cf1\cb2\highlight2 using\cf3  System.Collections.Generic;\par ??\cf1 using\cf3  Castle.Core;\par ??\cf1 using\cf3  Castle.Windsor;\par ??\par ??\cf1 namespace\cf3  CastleSamples\par ??\{\par ??    \cf1 class\cf3  \cf4 Program\par ??\cf3     \{\par ??        \cf1 static\cf3  \cf1 void\cf3  Main(\cf1 string\cf3 [] args)\par ??        \{\par ??            \cf4 WindsorContainer\cf3  container = \cf1 new\cf3  \cf4 WindsorContainer\cf3 ();\par ??            container.AddComponentWithLifestyle(\cf5 "logger.console"\cf3 , \cf1 typeof\cf3  (\cf6 ILogger\cf3 ), \cf1 typeof\cf3  (\cf4 ConsoleLogger\cf3 ),\par ??                                                \cf6 LifestyleType\cf3 .Singleton);\par ??            \cf4 Dictionary\cf3 &amp;lt;\cf1 string\cf3 , \cf1 object\cf3 &amp;gt; properties = \cf1 new\cf3  \cf4 Dictionary\cf3 &amp;lt;\cf1 string\cf3 , \cf1 object\cf3 &amp;gt;();\par ??            properties.Add(\cf5 "defaultFromAddress"\cf3 , \cf5 "administrator@example.com"\cf3 );\par ??            container.AddComponent(\cf5 "emailservice.smtp"\cf3 , \cf1 typeof\cf3  (\cf4 SmtpEmailService\cf3 ));\par ??\par ??            \cf4 SmtpEmailService\cf3  service = container.Resolve&amp;lt;\cf4 SmtpEmailService\cf3 &amp;gt;(properties);\par ??            service.SendEmail(\cf5 "me@example.com"\cf3 , \cf5 "Test email"\cf3 , \cf5 "This is a test email"\cf3 );\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Castle.Core;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Castle.Windsor;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; CastleSamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;Program&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Main(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;[] args)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;WindsorContainer&lt;/span&gt; container = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;WindsorContainer&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            container.AddComponentWithLifestyle(&lt;span style="color: lime;"&gt;"logger.console"&lt;/span&gt;, &lt;span style="color: rgb(255, 128, 0);"&gt;typeof&lt;/span&gt; (&lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt;), &lt;span style="color: rgb(255, 128, 0);"&gt;typeof&lt;/span&gt; (&lt;span style="color: yellow;"&gt;ConsoleLogger&lt;/span&gt;),&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                                                &lt;span style="color: rgb(43, 145, 175);"&gt;LifestyleType&lt;/span&gt;.Singleton);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;, &lt;span style="color: rgb(255, 128, 0);"&gt;object&lt;/span&gt;&amp;gt; properties = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;, &lt;span style="color: rgb(255, 128, 0);"&gt;object&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            properties.Add(&lt;span style="color: lime;"&gt;"defaultFromAddress"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"administrator@example.com"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            container.AddComponent(&lt;span style="color: lime;"&gt;"emailservice.smtp"&lt;/span&gt;, &lt;span style="color: rgb(255, 128, 0);"&gt;typeof&lt;/span&gt; (&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;));&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt; service = container.Resolve&amp;lt;&lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt;&amp;gt;(properties);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            service.SendEmail(&lt;span style="color: lime;"&gt;"me@example.com"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"Test email"&lt;/span&gt;, &lt;span style="color: lime;"&gt;"This is a test email"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
So, as you can see, it's pretty simple to set the parameters on our SmtpEmailService through the use of a Dictionary&amp;lt;TKey, TValue&amp;gt; generic collection.  The rest is just plain simple.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt;Method Call Injection&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
The Unity Application Block introduces another concept called method call injection.  Yes, that's right, instead of using constructor injection or setter injection, you can use method call injection.  The basic premise is that you can inject any method as you would for a constructor or setter.&lt;br /&gt;
&lt;br /&gt;
When would you use this though?  If you read the documentation, it lays out the explanation as follows:&lt;br /&gt;
&lt;ul&gt;
    &lt;li&gt;You want to instantiate dependent objects automatically when your instantiate the parent object&lt;/li&gt;
    &lt;li&gt;You want a simple approach that makes it easy to see in the code what the dependencies are for each class &lt;/li&gt;
    &lt;li&gt;The parent object requires a large number of constructors that forward to each other, making debugging and maintenance difficult &lt;/li&gt;
    &lt;li&gt;The parent object constructors require a large number of parameters, especially if they are of similar types and the only way to identify them is by position &lt;/li&gt;
    &lt;li&gt;You want to hide the dependent objects by not exposing them as properties &lt;/li&gt;
    &lt;li&gt;You want to control which objects are injected by editing the code of the dependent object instead of the parent object or application &lt;br /&gt;
    &lt;/li&gt;
&lt;/ul&gt;
By default unless any of this matches your criteria, you should just go ahead and use constructor injection.  But, let's walk through a small sample of using method injection:&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof65001\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green128\blue0;\red40\green40\blue40;\red255\green255\blue255;\red255\green255\blue0;\red43\green145\blue175;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2 using\cf3  Microsoft.Practices.Unity;\par ??\par ??\cf1 namespace\cf3  UnitySamples\par ??\{\par ??    \cf1 public\cf3  \cf1 class\cf3  \cf4 SmtpEmailService\cf3  : \cf5 IEmailService\par ??\cf3     \{\par ??        \cf1 private\cf3  \cf1 string\cf3  defaultFromAddress;\par ??        \cf1 private\cf3  \cf5 ILogger\cf3  logger;\par ??\par ??        [\cf4 InjectionMethod\cf3 ]\par ??        \cf1 public\cf3  \cf1 void\cf3  Initialize([\cf4 Dependency\cf3 (\cf6 "defaultFromAddress"\cf3 )] \cf1 string\cf3  defaultFromAddress, \cf5 ILogger\cf3  logger)\par ??        \{\par ??            \cf1 this\cf3 .defaultFromAddress = defaultFromAddress;\par ??            \cf1 this\cf3 .logger = logger;\par ??        \}\par ??\par ??        \cf1 public\cf3  \cf1 void\cf3  SendEmail(\cf1 string\cf3  to, \cf1 string\cf3  subject, \cf1 string\cf3  body)\par ??        \{\par ??            \cf6 // Send email\par ??\cf3             logger.Log(\cf1 string\cf3 .Format(\cf6 "Sending email from \{0\} to \{1\} with the subject \{2\} and body \{3\}"\cf3 , defaultFromAddress, to, subject, body));\par ??        \}\par ??    \}\par ??\}\par ??}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;using&lt;/span&gt; Microsoft.Practices.Unity;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;&lt;span style="color: rgb(255, 128, 0);"&gt;namespace&lt;/span&gt; UnitySamples&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;{&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;SmtpEmailService&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;IEmailService&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; defaultFromAddress;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt; logger;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        [&lt;span style="color: yellow;"&gt;InjectionMethod&lt;/span&gt;]&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; Initialize([&lt;span style="color: yellow;"&gt;Dependency&lt;/span&gt;(&lt;span style="color: lime;"&gt;"defaultFromAddress"&lt;/span&gt;)] &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; defaultFromAddress, &lt;span style="color: rgb(43, 145, 175);"&gt;ILogger&lt;/span&gt; logger)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;this&lt;/span&gt;.defaultFromAddress = defaultFromAddress;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;this&lt;/span&gt;.logger = logger;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; SendEmail(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; to, &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; subject, &lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt; body)&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: lime;"&gt;// Send email&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            logger.Log(&lt;span style="color: rgb(255, 128, 0);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: lime;"&gt;"Sending email from {0} to {1} with the subject {2} and body {3}"&lt;/span&gt;, defaultFromAddress, to, subject, body));&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;    }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
The rest of our program shouldn't have to change with this scenario.  But, as you will note from above, we decorated our Initialize method with an InjectionMethodAttribute which makes it realize that instead of constructor injection, use this instead.  And it works like a charm.  I haven't run into a scenario yet where I would find it useful, but I find it interesting.  If anyone does have a scenario that they've run into, please let me know.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt; Unity == ObjectBuilder2?&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
As you may have noticed, if you had downloaded the Unity Application Block, you'll notice that it is built upon ObjectBuilder2, but you may also notice that it hides a lot of functionality that it provides.  When you are marking your classes with DependencyAttribute and other things, you will notice that there are two of them, one in Unity and one in ObjectBuilder2, so this got me curious on what else I was missing out on.&lt;br /&gt;
&lt;br /&gt;
If you've played around with Enterprise Library in the past, you have probably dealt with ObjectBuilder.  It was not the most delightful piece of code I've ever had to deal with and not very intuitive.  &lt;a href="http://bradwilson.typepad.com/"&gt;Brad Wilson&lt;/a&gt; and &lt;a href="http://blogs.msdn.com/scottdensmore/"&gt;Scott Densmore&lt;/a&gt; took it upon themselves to rewrite this into a much more usable piece of code.  You can download the original and unencumbered ObjectBuilder2 from CodePlex &lt;a href="http://www.codeplex.com/ObjectBuilder/SourceControl/DownloadSourceCode.aspx?changeSetId=29957"&gt;here&lt;/a&gt;.&lt;br /&gt;
&lt;br /&gt;
Take a look at the CodePlex DependencyInjection project and its associated tests in Tests.CodePlex.DependencyInjection for a good idea on how well Brad and Scott did with their DI framework.  The best way to learn about any framework is to read the tests or specs (BDD style of course).  Let's look at two ways of doing code interception using the DI framework with using code and using attributes.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red255\green255\blue0;\red255\green128\blue0;\red43\green145\blue175;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2             [\cf3 Fact\cf1 ]\par ??            \cf4 public\cf1  \cf4 void\cf1  InterceptViaAttributes()\par ??            \{\par ??                \cf3 Recorder\cf1 .Records.Clear();\par ??                \cf3 DependencyContainer\cf1  container = \cf4 new\cf1  \cf3 DependencyContainer\cf1 ();\par ??                container.RegisterTypeMapping&amp;lt;\cf5 ISpy\cf1 , \cf3 SpyInterfaceAttributes\cf1 &amp;gt;();\par ??\par ??                \cf5 ISpy\cf1  obj = container.Get&amp;lt;\cf5 ISpy\cf1 &amp;gt;();\par ??                obj.InterceptedMethod();\par ??\par ??                \cf3 Assert\cf1 .Equal(3, \cf3 Recorder\cf1 .Records.Count);\par ??                \cf3 Assert\cf1 .Equal(\cf6 "Before Method"\cf1 , \cf3 Recorder\cf1 .Records[0]);\par ??                \cf3 Assert\cf1 .Equal(\cf6 "In Method"\cf1 , \cf3 Recorder\cf1 .Records[1]);\par ??                \cf3 Assert\cf1 .Equal(\cf6 "After Method"\cf1 , \cf3 Recorder\cf1 .Records[2]);\par ??            \}\par ??\par ??            [\cf3 Fact\cf1 ]\par ??            \cf4 public\cf1  \cf4 void\cf1  InterceptViaCode()\par ??            \{\par ??                \cf3 Recorder\cf1 .Records.Clear();\par ??                \cf3 DependencyContainer\cf1  container = \cf4 new\cf1  \cf3 DependencyContainer\cf1 ();\par ??                container.RegisterTypeMapping&amp;lt;\cf5 ISpy\cf1 , \cf3 SpyInterface\cf1 &amp;gt;();\par ??                container.InterceptInterface&amp;lt;\cf3 SpyInterface\cf1 &amp;gt;(\cf4 typeof\cf1 (\cf5 ISpy\cf1 ).GetMethod(\cf6 "InterceptedMethod"\cf1 ),\par ??                                                           \cf4 new\cf1  \cf3 RecordingHandler\cf1 ());\par ??\par ??                \cf5 ISpy\cf1  obj = container.Get&amp;lt;\cf5 ISpy\cf1 &amp;gt;();\par ??                obj.InterceptedMethod();\par ??\par ??                \cf3 Assert\cf1 .Equal(3, \cf3 Recorder\cf1 .Records.Count);\par ??                \cf3 Assert\cf1 .Equal(\cf6 "Before Method"\cf1 , \cf3 Recorder\cf1 .Records[0]);\par ??                \cf3 Assert\cf1 .Equal(\cf6 "In Method"\cf1 , \cf3 Recorder\cf1 .Records[1]);\par ??                \cf3 Assert\cf1 .Equal(\cf6 "After Method"\cf1 , \cf3 Recorder\cf1 .Records[2]);\par ??            \}}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;            [&lt;span style="color: yellow;"&gt;Fact&lt;/span&gt;]&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; InterceptViaAttributes()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records.Clear();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;DependencyContainer&lt;/span&gt; container = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;DependencyContainer&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                container.RegisterTypeMapping&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt;, &lt;span style="color: yellow;"&gt;SpyInterfaceAttributes&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt; obj = container.Get&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                obj.InterceptedMethod();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(3, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records.Count);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: lime;"&gt;"Before Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[0]);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: lime;"&gt;"In Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[1]);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: lime;"&gt;"After Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[2]);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            [&lt;span style="color: yellow;"&gt;Fact&lt;/span&gt;]&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; InterceptViaCode()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records.Clear();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;DependencyContainer&lt;/span&gt; container = &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;DependencyContainer&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                container.RegisterTypeMapping&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt;, &lt;span style="color: yellow;"&gt;SpyInterface&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                container.InterceptInterface&amp;lt;&lt;span style="color: yellow;"&gt;SpyInterface&lt;/span&gt;&amp;gt;(&lt;span style="color: rgb(255, 128, 0);"&gt;typeof&lt;/span&gt;(&lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt;).GetMethod(&lt;span style="color: lime;"&gt;"InterceptedMethod"&lt;/span&gt;),&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                                                           &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;RecordingHandler&lt;/span&gt;());&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt; obj = container.Get&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt;&amp;gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                obj.InterceptedMethod();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(3, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records.Count);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: lime;"&gt;"Before Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[0]);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: lime;"&gt;"In Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[1]);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: yellow;"&gt;Assert&lt;/span&gt;.Equal(&lt;span style="color: lime;"&gt;"After Method"&lt;/span&gt;, &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records[2]);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            }&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
Ok, so you may note that we registered this with an ISpy interface.  Then we have two implementations, one with code and one using attributes.  Let's now inspect that code.&lt;br /&gt;
&lt;br /&gt;
&lt;!--
{\rtf1\ansi\ansicpg\lang1024\noproof1252\uc1 \deff0{\fonttbl{\f0\fnil\fcharset0\fprq1 Monaco;}}{\colortbl;??\red255\green255\blue255;\red40\green40\blue40;\red255\green128\blue0;\red43\green145\blue175;\red255\green255\blue0;\red0\green255\blue0;}??\fs16 \cf1\cb2\highlight2             \cf3 public\cf1  \cf3 interface\cf1  \cf4 ISpy\par ??\cf1             \{\par ??                \cf3 void\cf1  InterceptedMethod();\par ??                \cf3 void\cf1  ThrowsException();\par ??            \}\par ??\par ??            \cf3 internal\cf1  \cf3 sealed\cf1  \cf3 class\cf1  \cf5 SpyInterface\cf1  : \cf4 ISpy\par ??\cf1             \{\par ??                \cf3 public\cf1  \cf3 void\cf1  InterceptedMethod()\par ??                \{\par ??                    \cf5 Recorder\cf1 .Records.Add(\cf6 "In Method"\cf1 );\par ??                \}\par ??\par ??                \cf3 public\cf1  \cf3 void\cf1  ThrowsException()\par ??                \{\par ??                    \cf5 Recorder\cf1 .Records.Add(\cf6 "In Method"\cf1 );\par ??                    \cf3 throw\cf1  \cf3 new\cf1  \cf5 Exception\cf1 ();\par ??                \}\par ??            \}\par ??\par ??            \cf3 internal\cf1  \cf3 sealed\cf1  \cf3 class\cf1  \cf5 SpyInterfaceAttributes\cf1  : \cf4 ISpy\par ??\cf1             \{\par ??                [\cf5 InterfaceIntercept\cf1 (\cf3 typeof\cf1 (\cf5 RecordingHandler\cf1 ))]\par ??                \cf3 public\cf1  \cf3 void\cf1  InterceptedMethod()\par ??                \{\par ??                    \cf5 Recorder\cf1 .Records.Add(\cf6 "In Method"\cf1 );\par ??                \}\par ??\par ??                \cf3 public\cf1  \cf3 void\cf1  ThrowsException()\par ??                \{\par ??                    \cf3 throw\cf1  \cf3 new\cf1  \cf5 Exception\cf1 ();\par ??                \}\par ??            \}\par ??        \}}
--&gt;
&lt;div style="background: rgb(40, 40, 40) none repeat scroll 0% 50%; font-family: Monaco; font-size: 8pt; color: white; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial;"&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;interface&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; InterceptedMethod();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; ThrowsException();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;internal&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;sealed&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;SpyInterface&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; InterceptedMethod()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                    &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records.Add(&lt;span style="color: lime;"&gt;"In Method"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; ThrowsException()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                    &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records.Add(&lt;span style="color: lime;"&gt;"In Method"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                    &lt;span style="color: rgb(255, 128, 0);"&gt;throw&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;Exception&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            &lt;span style="color: rgb(255, 128, 0);"&gt;internal&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;sealed&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;class&lt;/span&gt; &lt;span style="color: yellow;"&gt;SpyInterfaceAttributes&lt;/span&gt; : &lt;span style="color: rgb(43, 145, 175);"&gt;ISpy&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                [&lt;span style="color: yellow;"&gt;InterfaceIntercept&lt;/span&gt;(&lt;span style="color: rgb(255, 128, 0);"&gt;typeof&lt;/span&gt;(&lt;span style="color: yellow;"&gt;RecordingHandler&lt;/span&gt;))]&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; InterceptedMethod()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                    &lt;span style="color: yellow;"&gt;Recorder&lt;/span&gt;.Records.Add(&lt;span style="color: lime;"&gt;"In Method"&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt; &lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                &lt;span style="color: rgb(255, 128, 0);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;void&lt;/span&gt; ThrowsException()&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                {&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                    &lt;span style="color: rgb(255, 128, 0);"&gt;throw&lt;/span&gt; &lt;span style="color: rgb(255, 128, 0);"&gt;new&lt;/span&gt; &lt;span style="color: yellow;"&gt;Exception&lt;/span&gt;();&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;                }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;            }&lt;/p&gt;
&lt;p style="margin: 0px;"&gt;        }&lt;/p&gt;
&lt;/div&gt;
&lt;br /&gt;
As you may note, we have two methods that we're interested in, the InterceptedMethod and the ThrowsException method.  Then we can test through a Recorder that in fact the code was hit.  &lt;a href="http://www.codeplex.com/xunit"&gt;xUnit.net&lt;/a&gt; is used quite frequently throughout the code as it is a project also by Brad and &lt;a href="http://blogs.msdn.com/jamesnewkirk/"&gt;Jim Newkirk&lt;/a&gt;.  Overall, I'm very impressed with this code and I wish it had made more of an impact.&lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.tavaresstudios.com/blog"&gt; Chris Tavares&lt;/a&gt; and others from the Unity team have taken it upon themselves to redo a lot of the guts of ObjectBuilder2 as they continue to extend Unity.  For AOP, the plan is to include the Policy Injection Block into the solution, whereas ObjectBuilder2 already had this piece of functionality and does it quite well.  Some of it seems to be right now a little less featured than ObjectBuilder2 at this point, but that can change.  I have hopes for Unity, but ObjectBuilder2 did a lot of these things that it claims to do, just a little bit better.&lt;br /&gt;
&lt;br /&gt;
&lt;span style="font-weight: bold;"&gt; Wrapping it Up&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
Here wraps up another installment of looking at IoC containers and the various frameworks associated with it.  I hope that it whets your appetite to not only understand these containers, but see how they work deep down and see which matches your programming style.  Get to know your tools just a little bit better and find out what good quality code can be.  I hope you can take this to heart and see what works for you. &lt;br /&gt;
&lt;br /&gt;
&lt;a href="http://www.dotnetkicks.com/kick/?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/04/120185.aspx"&gt;&lt;img border="0" alt="kick it on DotNetKicks.com" src="http://www.dotnetkicks.com/Services/Images/KickItImageGenerator.ashx?url=http://geekswithblogs.net/Podwysocki/archive/2008/03/04/120185.aspx" /&gt;&lt;/a&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120185"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=120185" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/Podwysocki/aggbug/120185.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Matthew Podwysocki</dc:creator>
            <guid>http://geekswithblogs.net/Podwysocki/archive/2008/03/04/120185.aspx</guid>
            <pubDate>Tue, 04 Mar 2008 08:15:34 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/Podwysocki/comments/120185.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/Podwysocki/archive/2008/03/04/120185.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/Podwysocki/comments/commentRss/120185.aspx</wfw:commentRss>
            <trackback:ping>http://geekswithblogs.net/Podwysocki/services/trackbacks/120185.aspx</trackback:ping>
        </item>
    </channel>
</rss>