<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Espresso Fueled Agile Development : C#</title><link>http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx</link><description>Tags: C#</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>Who is using WCSF?</title><link>http://blogs.msdn.com/mpuleio/archive/2008/12/03/who-is-using-wcsf.aspx</link><pubDate>Wed, 03 Dec 2008 21:48:51 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9171225</guid><dc:creator>mpuleio</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/9171225.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=9171225</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=9171225</wfw:comment><description>&lt;p&gt;Blaine and I would like to ask the community to let us know &amp;quot;who is using WCSF?&amp;quot;&amp;#160; We know that WCSF has been fairly successful based on: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;WCSF has been downloaded a few times (ok, it is really many thousands of times) &lt;/li&gt;    &lt;li&gt;The discussion forums on CodePlex are fairly busy &lt;/li&gt;    &lt;li&gt;Direct customer engagement with a number of companies &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;However, there are a lot of folks who are using WCSF that we do not know about.&amp;#160; Since we get requests all the time about who is using WCSF, the size of projects, the size of dev teams, etc, we would love to collect some more data and statistics.&amp;#160; So, if you have used or are using WCSF on a project, let us know via comments, email, or discussions on CodePlex.&amp;#160; If you have stopped using it, please let us know why, so we can possibly address concerns.&lt;/p&gt;  &lt;p&gt;To make things simple, I have created a thread on the WCSF CodePlex discussion forum so you can easily provide feedback: &lt;a title="http://www.codeplex.com/websf/Thread/View.aspx?ThreadId=41405" href="http://www.codeplex.com/websf/Thread/View.aspx?ThreadId=41405"&gt;http://www.codeplex.com/websf/Thread/View.aspx?ThreadId=41405&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Thanks. &lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9171225" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Web+Client+Software+Factory/default.aspx">Web Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category></item><item><title>Where is WCSF headed?</title><link>http://blogs.msdn.com/mpuleio/archive/2008/12/03/where-is-wcsf-headed.aspx</link><pubDate>Wed, 03 Dec 2008 21:24:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9171150</guid><dc:creator>mpuleio</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/9171150.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=9171150</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=9171150</wfw:comment><description>&lt;p&gt;Blaine &amp;amp; I have been getting a lot of emails, messages, comments, etc about WCSF.&amp;#160; There are a lot of people interested in a public statement from patterns &amp;amp; practices about the roadmap for WCSF and future support of WCSF, in addition to the &amp;quot;normal&amp;quot; feature requests.&lt;/p&gt;  &lt;p&gt;Well, we have some good news: Blaine has publicly released the WCSF roadmap in his blog as &lt;a href="http://blogs.msdn.com/blaine/archive/2008/12/03/roadmap-for-wcsf.aspx"&gt;Roadmap for WCSF&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Basically, right now, we are asking for feedback from the community.&amp;#160; Let Blaine and/or I know what you want via our blogs, email, or the WCSF CodePlex site at &lt;a href="http://www.codeplex.com/websf"&gt;www.codeplex.com/websf&lt;/a&gt;.&amp;#160; You can also create work items/ issues on the WCSF CodePlex site and have people vote on them (&lt;a title="http://www.codeplex.com/websf/WorkItem/List.aspx" href="http://www.codeplex.com/websf/WorkItem/List.aspx"&gt;http://www.codeplex.com/websf/WorkItem/List.aspx&lt;/a&gt;).&amp;#160; &lt;/p&gt;  &lt;p&gt;Thanks in advance for the feedback...&lt;/p&gt;  &lt;p&gt;[Edit: I created a specific thread on the CodePlex discussions board to facilitate feedback: &lt;a title="http://www.codeplex.com/websf/Thread/View.aspx?ThreadId=41403" href="http://www.codeplex.com/websf/Thread/View.aspx?ThreadId=41403"&gt;http://www.codeplex.com/websf/Thread/View.aspx?ThreadId=41403&lt;/a&gt;). Enjoy]&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9171150" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Web+Client+Software+Factory/default.aspx">Web Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Finally, a common Service Locator</title><link>http://blogs.msdn.com/mpuleio/archive/2008/10/13/finally-a-common-service-locator.aspx</link><pubDate>Mon, 13 Oct 2008 20:03:57 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8998296</guid><dc:creator>mpuleio</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8998296.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8998296</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8998296</wfw:comment><description>&lt;p&gt;I know that this is old news by now, but &lt;a target="_blank" href="http://www.tavaresstudios.com/Blog/"&gt;Chris Tavares&lt;/a&gt;, &lt;a target="_blank" href="http://blogs.msdn.com/gblock/default.aspx"&gt;Glenn Block&lt;/a&gt;, and a few others around here have been working with a number of folks from the wider .NET community to create a common wrapper for IoC containers.&amp;nbsp; Chris &amp;amp; Glenn created a community site (&lt;a title="http://www.codeplex.com/CommonServiceLocator" href="http://www.codeplex.com/CommonServiceLocator"&gt;http://www.codeplex.com/CommonServiceLocator&lt;/a&gt;) and shipped it about two weeks ago (&lt;a title="http://www.codeplex.com/CommonServiceLocator/Release/ProjectReleases.aspx?ReleaseId=17694" href="http://www.codeplex.com/CommonServiceLocator/Release/ProjectReleases.aspx?ReleaseId=17694"&gt;http://www.codeplex.com/CommonServiceLocator/Release/ProjectReleases.aspx?ReleaseId=17694&lt;/a&gt;).&lt;/p&gt; &lt;p&gt;Here are a few more posts about it:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://www.tavaresstudios.com/Blog/post/Announcing-The-IServiceLocator-interface.aspx"&gt;Announcing: The IServiceLocator interface&lt;/a&gt;  &lt;li&gt;&lt;a target="_blank" href="http://blogs.msdn.com/gblock/archive/2008/10/02/iservicelocator-a-step-toward-ioc-container-service-locator-detente.aspx"&gt;IServiceLocator a step toward IoC container / Service locator detente&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;The interface itself is pretty darned simple, and creating a wrapper around any IoC implementation should be pretty darned simple.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Personally, I think this is great, as it will allow us developers at p&amp;amp;p a way to easily create guidance using DI/IoC without tying our users to a particular container implementation, which has been a long requested feature. I know Prism did a great job with this concept already, and created their own facade, but this is a further step in the right direction as the broader DI/IoC community seems to be behind it.&amp;nbsp; When/If I get a chance to work on WCSF again, I'll definitely go about hiding the container behind this interface.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8998296" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Unity/default.aspx">Unity</category></item><item><title>Composite Application Guidance for WPF Shipped!</title><link>http://blogs.msdn.com/mpuleio/archive/2008/07/31/composite-application-guidance-for-wpf-shipped.aspx</link><pubDate>Thu, 31 Jul 2008 20:26:13 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8793821</guid><dc:creator>mpuleio</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8793821.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8793821</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8793821</wfw:comment><description>&lt;p&gt;&lt;/p&gt; &lt;p&gt;A while back, I was Dev Lead on the Smart Client Software Factory (SCSF) when we added the ability to host WPF controls in a Composite Application Block (CAB) application. Since then, the thinking in the WPF space has changed a bit, and p&amp;amp;p decided that offering guidance on full WPF applications was a good idea.&amp;nbsp; &lt;a href="http://blogs.msdn.com/blaine" target="_blank"&gt;Blaine&lt;/a&gt;, &lt;a href="http://blogs.msdn.com/francischeung" target="_blank"&gt;Francis&lt;/a&gt;, Bob, and &lt;a href="http://blogs.msdn.com/gblock" target="_blank"&gt;Glenn&lt;/a&gt; have worked with a great team to create guidance for building composite applications using WPF. This guidance was started from a clean slate, as there are enough differences between Windows Forms and WPF (as we learned doing SCSF) to cause challenges.&amp;nbsp; The result is the &lt;a href="http://msdn.microsoft.com/en-us/library/cc707819.aspx" target="_blank"&gt;Composite Application Guidance for WPF June 2008&lt;/a&gt;, which recently shipped (formerly code-named &lt;a href="http://codeplex.com/CompositeWPF" target="_blank"&gt;Prism&lt;/a&gt;).&amp;nbsp; This guidance is simple, easy to consume, can be used piecemeal, and should not have the steep learning curve that CAB and SCSF have.&amp;nbsp; You can learn more at the &lt;a href="http://codeplex.com/CompositeWPF" target="_blank"&gt;Prism CodePlex Community Site&lt;/a&gt;, or at any of the places below.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Check out Francis's post, &lt;a href="http://blogs.msdn.com/francischeung/archive/2008/07/17/shipped-composite-application-guidance-for-wpf-june-2008.aspx" target="_blank"&gt;SHIPPED!!! Composite Application Guidance for WPF June 2008&lt;/a&gt;, for details and where to get it.&lt;/p&gt; &lt;p&gt;Or take a look at Glenn's post on the subject: &lt;a href="http://blogs.msdn.com/gblock/archive/2008/07/03/composite-application-guidance-is-live.aspx"&gt;Composite Application Guidance is Live&lt;/a&gt;&lt;/p&gt; &lt;p&gt;And here are a few other posts about what they have been up to, by person in chronological order:&lt;/p&gt; &lt;p&gt;From Francis:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/francischeung/archive/2008/01/28/composite-wpf-guidance.aspx"&gt;Composite WPF Guidance&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/francischeung/archive/2008/01/28/di-or-not-di.aspx"&gt;DI or not DI&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/francischeung/archive/2008/05/29/decoupled-communication-with-prism-intro.aspx"&gt;Decoupled Communication with Prism (intro)&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/francischeung/archive/2008/05/29/decoupled-communication-with-prism-shared-views-services.aspx"&gt;Decoupled Communication with Prism (Shared Services)&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/francischeung/archive/2008/05/30/decoupled-communication-with-prism-commanding.aspx"&gt;Decoupled Communication with Prism (Commanding)&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/francischeung/archive/2008/06/02/decoupled-communication-with-prism-event-aggregation.aspx"&gt;Decoupled Communication with Prism (Event Aggregation)&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/francischeung/archive/2008/06/16/poor-man-s-ui-composition.aspx"&gt;Poor man's UI Composition&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/francischeung/archive/2008/07/16/activeaware-views-and-commands.aspx"&gt;ActiveAware Views and Commands&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;From Blaine:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/blaine/archive/2008/05/15/track-prim-project.aspx"&gt;Track Prism project&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/blaine/archive/2008/06/08/loosely-couple-communication.aspx"&gt;Loosely coupled communication&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;From Glenn:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/03/12/prism-launches-on-codeplex.aspx"&gt;'Prism' launches on CodePlex&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/03/12/prism-ri-first-drop.aspx"&gt;'Prism' RI first drop&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/03/26/prism-drop-2.aspx"&gt;Prism Drop 2&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/04/01/prism-talk-at-wpf-bootcamp.aspx"&gt;Prism talk at WPF Bootcamp&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/04/27/the-prism-team-and-how-we-develop.aspx"&gt;The Prism team and how we develop&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/04/29/brian-noyes-thoughts-on-prism.aspx"&gt;Brian Noyes thoughts on Prism&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/05/05/prismshouldnotreferenceunity.aspx"&gt;PrismShouldNotReferenceUnity&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/05/08/prism-vs-framework-xxx.aspx"&gt;Prism vs Framework XXX&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/05/08/wpf-from-this-to-that-wow.aspx"&gt;WPF, from this to that..Wow!&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/05/11/prism-cab-and-winforms-futures.aspx"&gt;Prism, CAB, and WinForms futures&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/05/24/using-viewmodels-and-datatemplates-to-compose-your-ui.aspx"&gt;Using ViewModels and DataTemplates to compose your UI&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/06/04/loosely-coupled-communication-prism-style.aspx"&gt;Loosely coupled communication - Prism style&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/06/12/stocktrader-ri-using-castle-windsor.aspx"&gt;StockTrader RI using Castle Windsor&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/06/30/composite-application-guidance-time-to-ship.aspx"&gt;Composite Application Guidance, time to ship&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/06/30/talking-about-prism-with-infoq.aspx"&gt;Talking about Prism with InfoQ&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/07/01/how-prism-supports-using-multiple-ioc-containers.aspx"&gt;How Prism supports using multiple IOC containers&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/07/02/composite-application-guidance-what-is-it.aspx"&gt;Composite Application Guidance - What is it?&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/gblock/archive/2008/07/03/composite-application-guidance-is-live.aspx"&gt;Composite Application Guidance is Live&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I know I am looking forward to using this guidance when I get a chance to work with WPF more seriously.&lt;/p&gt; &lt;p&gt;Enjoy.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8793821" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Smart+Client+Software+Factory/default.aspx">Smart Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/WPF/default.aspx">WPF</category></item><item><title>Proof of Concept: a simple DI solution for ASP.NET WebForms</title><link>http://blogs.msdn.com/mpuleio/archive/2008/07/17/proof-of-concept-a-simple-di-solution-for-asp-net-webforms.aspx</link><pubDate>Thu, 17 Jul 2008 23:32:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8744912</guid><dc:creator>mpuleio</dc:creator><slash:comments>3</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8744912.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8744912</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8744912</wfw:comment><description>&lt;p&gt;&lt;a href="http://www.tavaresstudios.com/Blog/" target="_blank"&gt;Chris Tavares&lt;/a&gt; and I were chatting yesterday morning about an idea Chris had: building a simple, reusable Http Module that gives folks DI scoped to the Application, Session, and Request.&amp;nbsp; Yesterday afternoon, during the p&amp;amp;p Dev team's weekly "Code Kata" we threw together a spike/proof of concept in a couple of hours.&amp;nbsp; "Code Kata" is a three hour block of time that the p&amp;amp;p Dev team uses for a number of things: &lt;/p&gt; &lt;ul&gt; &lt;li&gt;cross-project pollination of ideas, things that work, things that don't work across project teams &lt;li&gt;investigating new and emerging technologies that p&amp;amp;p may work with in the future  &lt;li&gt;investigating new and emerging platforms to determine if p&amp;amp;p may want to provide guidance in the future  &lt;li&gt;play with new shiny bits :-)&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;There are no unit tests, just simple acceptance tests written as a really simple web site.&amp;nbsp; If the site works and shows the right text, the test passes.&amp;nbsp; We started with a list of requirements (scaled to just the application level) on the whiteboard that looked sort of like this (which I am creating from memory):&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Create a DI container for the application  &lt;li&gt;Create a way to get to the container ( we choose an extension method on the Application class)  &lt;li&gt;Allow a way to configure the container  &lt;li&gt;Allow DI to work for pages  &lt;li&gt;Allow DI to work for user controls  &lt;li&gt;Allow DI to work for master pages  &lt;li&gt;Allow DI to work for ASMX web services  &lt;li&gt;Allow the above functionality in a simple and self contained way&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;So, we created a simple Web Site Application and a DLL to hold the custom HttpModule.&amp;nbsp; We created a simple web page that needed a property injected into it.&amp;nbsp; We then wrote the code to make my "test" page work properly.&amp;nbsp; First we wrote an extension method for HttpApplication.&amp;nbsp; After a short bit it changed to one for HttpApplicationState: &lt;/p&gt; &lt;blockquote&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.Practices.Unity;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;UnityForTheWebLib
{
    &lt;span style="color: blue"&gt;public static class &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: #2b91af"&gt;HttpApplicationStateExtensions
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;private const string &lt;/span&gt;GlobalContainerKey = &lt;span style="color: #a31515"&gt;"Your global Unity container"&lt;/span&gt;;

        &lt;span style="color: blue"&gt;public static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IUnityContainer &lt;/span&gt;GetContainer(&lt;span style="color: blue"&gt;this &lt;/span&gt;&lt;span style="color: #2b91af"&gt;HttpApplicationState &lt;/span&gt;application)
        {
            application.Lock();
            &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;try
            &lt;/span&gt;{
                &lt;span style="color: #2b91af"&gt;IUnityContainer &lt;/span&gt;container = application[GlobalContainerKey] &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IUnityContainer&lt;/span&gt;;
                &lt;span style="color: blue"&gt;if&lt;/span&gt;(container == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
                {
                    container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityContainer&lt;/span&gt;();
                    application[GlobalContainerKey] = container;
                }
                &lt;span style="color: blue"&gt;return &lt;/span&gt;container;
            }
            &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="Consolas"&gt;&lt;span style="color: blue"&gt;finally
            &lt;/span&gt;{
                application.UnLock();
            }
        }
    }
}&lt;/font&gt;&lt;/font&gt;
&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Basically, we have lazy initialization of the container and a mechanism to stuff it into the application state.&amp;nbsp; And then the initial HttpModule that only does injection on a Page:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.UI;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.Practices.Unity;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;UnityForTheWebLib
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityHttpModule &lt;/span&gt;: &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: #2b91af"&gt;IHttpModule
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;#region &lt;/span&gt;IHttpModule Members

        &lt;/font&gt;&lt;/font&gt;&lt;span style="color: gray"&gt;&lt;font face="con" size="2"&gt;///&amp;lt;summary&amp;gt;
        ///&lt;/font&gt;&lt;/span&gt;&lt;span style="color: green"&gt;&lt;font face="con" size="2"&gt;Initializes a module and prepares it to handle requests.
        &lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: gray"&gt;///&amp;lt;/summary&amp;gt;
        ///
        ///&amp;lt;param name="context"&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;An &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;see cref="T:System.Web.HttpApplication"&amp;gt;&amp;lt;/see&amp;gt; &lt;/span&gt;&lt;span style="color: green"&gt;that provides access to the methods, properties, and events common to all application objects within an ASP.NET application &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;
        &lt;/span&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;Init(&lt;span style="color: #2b91af"&gt;HttpApplication &lt;/span&gt;context)
        {
            context.PreRequestHandlerExecute += OnPreRequestHandlerExecute;
        }

        &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: gray"&gt;///&amp;lt;summary&amp;gt;
        ///&lt;/span&gt;&lt;span style="color: green"&gt;Disposes of the resources (other than memory) used by the module that implements &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;see cref="T:System.Web.IHttpModule"&amp;gt;&amp;lt;/see&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="color: green"&gt;&lt;font face="con" size="2"&gt;.
        &lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: gray"&gt;///&amp;lt;/summary&amp;gt;
        ///
        &lt;/span&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;Dispose()
        {
        }

        &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: blue"&gt;#endregion

        private void &lt;/span&gt;OnPreRequestHandlerExecute(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: #2b91af"&gt;IHttpHandler &lt;/span&gt;handler = &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.Handler;
            &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.Application.GetContainer().BuildUp(handler.GetType(), handler);
        }
    }
}&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;This is a very simple module that calls BuildUp on the page.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;At this point we added another test, and implemented it.&amp;nbsp; After a few iterations of this we ended up with tests for injection into a User Control and a Master Page, an interface that needed to be configured on the container.&amp;nbsp; The final implementation of the Http Module looks like this &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;&lt;br&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;&lt;br&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web;&lt;br&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.UI;&lt;br&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.Practices.Unity;&lt;br&gt;&lt;br&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;UnityForTheWebLib&lt;br&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityHttpModule &lt;/span&gt;: &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: #2b91af"&gt;IHttpModule&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;#region &lt;/span&gt;IHttpModule Members&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;span style="color: gray"&gt;&lt;font face="con" size="2"&gt;///&amp;lt;summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///&lt;/font&gt;&lt;/span&gt;&lt;span style="color: green"&gt;&lt;font face="con" size="2"&gt;Initializes a module and prepares it to handle requests.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: gray"&gt;///&amp;lt;/summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///&amp;lt;param name="context"&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt;An &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;see cref="T:System.Web.HttpApplication"&amp;gt;&amp;lt;/see&amp;gt; &lt;/span&gt;&lt;span style="color: green"&gt;that provides access to the methods, properties, and events common to all application objects within an ASP.NET application &lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: gray"&gt;&amp;lt;/param&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;Init(&lt;span style="color: #2b91af"&gt;HttpApplication &lt;/span&gt;context)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; context.PreRequestHandlerExecute += OnPreRequestHandlerExecute;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: gray"&gt;///&amp;lt;summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///&lt;/span&gt;&lt;span style="color: green"&gt;Disposes of the resources (other than memory) used by the module that implements &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;see cref="T:System.Web.IHttpModule"&amp;gt;&amp;lt;/see&amp;gt;&lt;/span&gt;&lt;/font&gt;&lt;/font&gt;&lt;span style="color: green"&gt;&lt;font face="con" size="2"&gt;.&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/span&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: gray"&gt;///&amp;lt;/summary&amp;gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ///&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;public void &lt;/span&gt;Dispose()&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: blue"&gt;#endregion&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; private void &lt;/span&gt;OnPreRequestHandlerExecute(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af"&gt;IHttpHandler &lt;/span&gt;handler = &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.Handler;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.Application.GetContainer().BuildUp(handler.GetType(), handler);&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: green"&gt;// User Controls are ready to be built up after the page initialization is complete&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Page &lt;/span&gt;page = &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.Handler &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Page&lt;/span&gt;;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;if &lt;/span&gt;(page != &lt;span style="color: blue"&gt;null&lt;/span&gt;)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; page.InitComplete += OnPageInitComplete;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: green"&gt;// Get the controls in the page's control tree excluding the page itself&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEnumerable&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Control&lt;/span&gt;&amp;gt; GetControlTree(&lt;span style="color: #2b91af"&gt;Control &lt;/span&gt;root)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Control &lt;/span&gt;child &lt;span style="color: blue"&gt;in &lt;/span&gt;root.Controls)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;yield return &lt;/span&gt;child;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Control &lt;/span&gt;c &lt;span style="color: blue"&gt;in &lt;/span&gt;GetControlTree(child))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;yield return &lt;/span&gt;c;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: green"&gt;// Build up each control in the page's control tree&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;OnPageInitComplete(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af"&gt;Page &lt;/span&gt;page = (&lt;span style="color: #2b91af"&gt;Page&lt;/span&gt;) sender;&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: #2b91af"&gt;IUnityContainer &lt;/span&gt;container = &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.Application.GetContainer();&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: blue"&gt;foreach &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Control &lt;/span&gt;c &lt;span style="color: blue"&gt;in &lt;/span&gt;GetControlTree(page))&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; container.BuildUp(c.GetType(), c);&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;br&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/p&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Configuration of the container can happen in the Global Application_Start handler like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.Practices.Unity;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;UnityForTheWebTestSite
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Global &lt;/span&gt;: System.Web.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="con"&gt;&lt;span style="color: #2b91af"&gt;HttpApplication
    &lt;/span&gt;{

        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;Application_Start(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: #2b91af"&gt;IUnityContainer &lt;/span&gt;c = Application.GetContainer();
            c.RegisterType&amp;lt;&lt;span style="color: #2b91af"&gt;IControlData&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;ControlData1&lt;/span&gt;&amp;gt;();
        }
    }
}&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;So, from the initial requirements we have this:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;strike&gt;Create a DI container for the application&lt;/strike&gt; &lt;strong&gt;Lazy initialization&lt;/strong&gt; 
&lt;li&gt;&lt;strike&gt;Create a way to get to the container ( we choose an extension method on the Application class) &lt;/strike&gt;&lt;strong&gt;Extension Method&lt;/strong&gt; 
&lt;li&gt;&lt;strike&gt;Allow a way to configure the container&lt;/strike&gt; &lt;strong&gt;Application Start&lt;/strong&gt; 
&lt;li&gt;&lt;strike&gt;Allow DI to work for pages&lt;/strike&gt;&amp;nbsp; &lt;strong&gt;Add the HttpModule and Attributes&lt;/strong&gt; 
&lt;li&gt;&lt;strike&gt;Allow DI to work for user controls &lt;/strike&gt;&lt;strong&gt;Add the HttpModule and Attributes&lt;/strong&gt; 
&lt;li&gt;&lt;strike&gt;Allow DI to work for master pages &lt;/strike&gt;&lt;strong&gt;Add the HttpModule and Attributes&lt;/strong&gt; 
&lt;li&gt;Allow DI to work for ASMX web services 
&lt;li&gt;&lt;strike&gt;Allow the above functionality in a simple and self contained way&lt;/strike&gt; &lt;strong&gt;This is all in a single module&lt;/strong&gt;&lt;/li&gt;&lt;/ul&gt;We met the last requirement (simple and self contained) since all we did to the web application was add a single line to the web config.&amp;nbsp; That met the requirement. 
&lt;p&gt;The last area is one we met, but we are not happy with the solution.&amp;nbsp; Basically, we need to do a bit more research and see if there is a way to get into the pipeline for an ASMX request early enough to do injection and not screw things up for the normal use case or the Ajax extensions.&amp;nbsp; Until we get this figured out right, the solution is to have your Web Service constructor ask the container to do injection.&amp;nbsp; This is an ugly hack and looks something like this:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;font size="2"&gt;&lt;font face="consol"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.ComponentModel;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.Services;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Microsoft.Practices.Unity;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;UnityForTheWebTestSite
{&lt;/font&gt;&lt;/font&gt;&lt;span style="color: gray"&gt;
&lt;font face="consol" size="2"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font face="consol" size="2"&gt;[&lt;span style="color: #2b91af"&gt;WebService&lt;/span&gt;(Namespace = &lt;span style="color: #a31515"&gt;"http://tempuri.org/"&lt;/span&gt;)]
    [&lt;span style="color: #2b91af"&gt;WebServiceBinding&lt;/span&gt;(ConformsTo = &lt;span style="color: #2b91af"&gt;WsiProfiles&lt;/span&gt;.BasicProfile1_1)]
    [&lt;span style="color: #2b91af"&gt;ToolboxItem&lt;/span&gt;(&lt;span style="color: blue"&gt;false&lt;/span&gt;)]
    &lt;/font&gt;&lt;font size="2"&gt;&lt;font face="consol"&gt;&lt;span style="color: green"&gt;// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    // [System.Web.Script.Services.ScriptService]
    &lt;/span&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MyWebService &lt;/span&gt;: System.Web.Services.&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font face="consol"&gt;&lt;span style="color: #2b91af"&gt;WebService
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;public &lt;/span&gt;MyWebService()
        {
            &lt;span style="color: #2b91af"&gt;HttpContext&lt;/span&gt;.Current.Application.GetContainer().BuildUp(&lt;span style="color: blue"&gt;this&lt;/span&gt;);
        }

        [&lt;span style="color: #2b91af"&gt;Dependency&lt;/span&gt;]
        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IControlData &lt;/span&gt;Data
        {
            &lt;span style="color: blue"&gt;get&lt;/span&gt;;
            &lt;span style="color: blue"&gt;set&lt;/span&gt;;
        }

        [&lt;span style="color: #2b91af"&gt;WebMethod&lt;/span&gt;]
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;HelloWorld()
        {
            &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #a31515"&gt;"Hello World " &lt;/span&gt;+ Data.GetText();
        }
    }
}&lt;/font&gt;&lt;/font&gt;&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;To add the ability to have a container at the Session level and the request level should be as simple as following the pattern for the extension method and the http handler above. (I will leave it as an exercise for the reader.) You could use the same container for everything, or have the Session container a child of the application container, and the request container a child of the session container.&amp;nbsp; When and if we do a real implementation (as opposed to a proof of concept) we will figure out the best approach for most cases.&amp;nbsp; When and if this happens, I will update my CWAB with Unity solution and dramatically simplify it. :-)&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8744912" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Web+Client+Software+Factory/default.aspx">Web Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Unity/default.aspx">Unity</category></item><item><title>Converting the Composite Web Application Block to Unity - Using the UnityCompositionContainer</title><link>http://blogs.msdn.com/mpuleio/archive/2008/05/21/converting-the-composite-web-application-block-to-unity-using-the-unitycompositioncontainer.aspx</link><pubDate>Wed, 21 May 2008 19:38:11 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8528652</guid><dc:creator>mpuleio</dc:creator><slash:comments>8</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8528652.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8528652</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8528652</wfw:comment><description>&lt;p&gt;This is the sixth post in a series. The other post include:  &lt;ul&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/mpuleio/archive/2008/04/04/converting-the-composite-web-application-block-to-unity-intro.aspx"&gt;Converting the Composite Web Application Block to Unity - Intro&lt;/a&gt;.  &lt;li&gt;&lt;a href="http://blogs.msdn.com/mpuleio/archive/2008/04/04/converting-the-composite-web-application-block-to-unity-adding-an-icompositioncontainer.aspx" target="_blank"&gt;Converting the Composite Web Application Block to Unity - Adding an ICompositionContainer&lt;/a&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/mpuleio/archive/2008/04/09/converting-the-composite-web-application-block-to-unity-clean-up-icompositioncontainer.aspx"&gt;Converting the Composite Web Application Block to Unity - Clean Up ICompositionContainer&lt;/a&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/mpuleio/archive/2008/04/22/converting-the-composite-web-application-block-to-unity-ummmm-oooops.aspx"&gt;Converting the Composite Web Application Block to Unity - Ummmm...Oooops.&lt;/a&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/mpuleio/archive/2008/05/01/converting-the-composite-web-application-block-to-unity-actually-adding-unity.aspx" target="_blank"&gt;Converting the Composite Web Application Block to Unity - Actually Adding Unity&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;If you want background, go read the earlier posts.  &lt;p&gt;Based upon feedback, I am making the source code available at &lt;a title="http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity" href="http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity" target="_blank"&gt;CWAB and Unity&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;For those who have been following along, you all know I am making this up as I go. So, I am asking that you be patient with me as we figure this out together. This article (in particular) may have a few false starts, and "ooops" moments.&amp;nbsp; We are replacing something that was not meant to be pluggable, and all of the refactoring work that has been done up to this point may not be enough.&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;Reminder:&amp;nbsp; &lt;/strong&gt;&lt;em&gt;&lt;u&gt;This is a proof of concept&lt;/u&gt;&lt;/em&gt;.&amp;nbsp; The version of CWAB I am creating here is not a supported product or guidance from patterns &amp;amp; practices.&amp;nbsp; If you really want Unity support in WCSF, please go to the Issue Tracker on the &lt;a href="http://www.codeplex.com/websf" target="_blank"&gt;WCSF Community Site&lt;/a&gt; and vote for the work item to get Unity support for WCSF.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;At the end of the last post I planned on trying to actually use the UnityCompositionContainer, and then nuke the old CompositionContainer.&lt;/p&gt; &lt;p&gt;Let's get started by replacing any calls that creates a CompositionContainer with code that creates a UnityCompositionContainer.&amp;nbsp; There is ONE spot, in WebClientApplication.&amp;nbsp; Simple. Change, recompile, re-run unit tests, and we are green. &lt;/p&gt; &lt;p&gt;If it really was that simple, we should be able to remove the CompositionContainer class (and its test fixture) from the solution, and not have any challenges.&amp;nbsp; Let's try that.&lt;/p&gt; &lt;p&gt;We fail to compile.&amp;nbsp; Our TestableRootCompositionContainer is part of the problem. MockContainer in ManagedObjectCollectionFixture is the rest of it.&lt;/p&gt; &lt;p&gt;If we derive TestableRootCompositionContainer from UnityContainer, and remove everything from the class (as a temporary measure), we go from two to 27 build errors.&amp;nbsp; &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&amp;lt;timewarp duration="an or two"/&amp;gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Not good.&amp;nbsp; But not too bad, considering what comes next.&amp;nbsp; After fixing these build errors, I got on a roll, and did the following:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Removed references to the old ObjectBuilder.dll in both unit test and system projects  &lt;li&gt;Removed the BuilderStrategies folder in both unit test and system projects  &lt;li&gt;Removed the Collections folder in both unit test and system projects  &lt;li&gt;Removed the ObjectBuilder folder in both unit test and system projects  &lt;li&gt;Removed the ProviderDependencyAttribute and its fixture  &lt;li&gt;Removed StateDependencyAttribute and its fixture  &lt;li&gt;Removed OptionalDependencyAttribute and its fixture  &lt;li&gt;Removed ServiceDependencyAttribute and its fixture  &lt;li&gt;Removed all references to the old ObjectBuilder namespace  &lt;li&gt;Replaced any [CreateNew] attributes with the Unity [Dependency] attribute  &lt;li&gt;Hacked on WebClientApplication  &lt;li&gt;Removed the Services collection.&amp;nbsp; Replaced calls to container.Services.Add with container.RegisterType.&amp;nbsp; If needed added a call to container.Resolve, when the Services.Add call was supposed to return an object.&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;Ok, things are compiling again.&amp;nbsp; Finally.&amp;nbsp; But there are a few failing unit tests, about 20 or so...&amp;nbsp; Let's fix those.&lt;/p&gt; &lt;p&gt;&amp;lt;type... type.... swear.... type /&amp;gt;&lt;/p&gt; &lt;p&gt;Getting those test to pass was fairly simple.&amp;nbsp; All of them required a little bit of container setup that was different than before.&amp;nbsp; This was not a big deal.&lt;/p&gt; &lt;p&gt;There is one major change I did make in the process, and a related renaming.&amp;nbsp; First, the renaming, Page became InjectablePage; MasterPage became InjectableMasterPage, and guess what UserControl became? Excactly, InjectableUserControl.&amp;nbsp; These are better descriptions and will remove the confusion I have dealt with on the forums where people use the wrong Page base class.&amp;nbsp; The other change is that, previously CompositionContainer had two Builders: one for things like services that stayed around, and another for Pages and transient items like presenters.&amp;nbsp; We no longer need two builders, and can get containers and lifetime managers to handle the differences.&amp;nbsp; The approach I took for simplicity is to have each page create a container that is a child of the correct Module container, use this for doing injection on the page, and then nuking the container on Page.Dispose.&amp;nbsp; This is quick and dirty, and it works, but I may revisit it later. &lt;/p&gt; &lt;p&gt;Now, since Unity 1.1 just shipped, it is time to upgrade.&amp;nbsp; I replaced the binaries and...&lt;/p&gt; &lt;p&gt;Everything still passes.&lt;/p&gt; &lt;p&gt;I think that is enough for today.&lt;/p&gt; &lt;p&gt;As a quick check, I just looked at the solution statistics for the original version of CWAB and the current solution.&amp;nbsp; CWAB went from 26KLOC (pre-article one) to 14KLOC, both numbers including unit tests.&amp;nbsp; And I bet that there is more to be cut out and cleaned up.&amp;nbsp; Having a purpose built, re-usable component for DI helped a lot here.&amp;nbsp; For this edition, windiff will probably be the best bet for following all the types of changes I made.&amp;nbsp; This one took a while and impacted &lt;em&gt;&lt;strong&gt;a lot &lt;/strong&gt;&lt;/em&gt;of code.&lt;/p&gt; &lt;p&gt;Next, I am going to review unit tests, run code coverage, determine if there are gaps in test coverage after all the hacking.&amp;nbsp; After that, it will be porting one of the quickstarts over to the new version of CWAB.&amp;nbsp; After that, the RI, at which point I will be sure that the updated version works well enough to be a good proof of concept.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8528652" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Web+Client+Software+Factory/default.aspx">Web Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Unity/default.aspx">Unity</category></item><item><title>Converting the Composite Web Application Block to Unity - Actually Adding Unity</title><link>http://blogs.msdn.com/mpuleio/archive/2008/05/01/converting-the-composite-web-application-block-to-unity-actually-adding-unity.aspx</link><pubDate>Fri, 02 May 2008 02:44:34 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8447888</guid><dc:creator>mpuleio</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8447888.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8447888</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8447888</wfw:comment><description>&lt;p&gt;This is the fifth post in a series. The other post include:  &lt;ul&gt; &lt;li&gt;&lt;a href="http://blogs.msdn.com/mpuleio/archive/2008/04/04/converting-the-composite-web-application-block-to-unity-intro.aspx"&gt;Converting the Composite Web Application Block to Unity - Intro&lt;/a&gt;.  &lt;li&gt;&lt;a href="http://blogs.msdn.com/mpuleio/archive/2008/04/04/converting-the-composite-web-application-block-to-unity-adding-an-icompositioncontainer.aspx" target="_blank"&gt;Converting the Composite Web Application Block to Unity - Adding an ICompositionContainer&lt;/a&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/mpuleio/archive/2008/04/09/converting-the-composite-web-application-block-to-unity-clean-up-icompositioncontainer.aspx"&gt;Converting the Composite Web Application Block to Unity - Clean Up ICompositionContainer&lt;/a&gt;  &lt;li&gt;&lt;a href="http://blogs.msdn.com/mpuleio/archive/2008/04/22/converting-the-composite-web-application-block-to-unity-ummmm-oooops.aspx"&gt;Converting the Composite Web Application Block to Unity - Ummmm...Oooops.&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;If you want background, go read the earlier posts.  &lt;p&gt;Based upon feedback, I am making the source code available at &lt;a title="http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity" href="http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity" target="_blank"&gt;CWAB and Unity&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;First off, I have moved this little side project to source control, so I can avoid the re-work I had to do before I could write this part of the series. &lt;/p&gt; &lt;p&gt;Note to self :&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;em&gt;NEVER work without a safety net.&amp;nbsp; That means both unit tests and source control. &lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;Ok.&amp;nbsp; Now that that is out of the way....&lt;/p&gt; &lt;p&gt;Let's go add Unity to CWAB, via EDD (formerly TDD).&lt;/p&gt; &lt;p&gt;How can we do this?&amp;nbsp; First, we need a test fixture.&amp;nbsp; So, I added &lt;span style="color: #2b91af"&gt;CompositionContainerFixture&lt;/span&gt; to the CompositeWeb.Tests project as an empty test fixture.&amp;nbsp; And then I added the following very simple test as a starting point:&lt;/p&gt; &lt;blockquote&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
&lt;span style="color: blue"&gt;public void &lt;/span&gt;UnityCompositionContainerIsICompositionContainer()
{
    UnityCompositionContainer container = &lt;span style="color: blue"&gt;new &lt;/span&gt;UnityCompositionContainer();
    &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsInstanceOfType(container, &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ICompositionContainer&lt;/span&gt;));
}
&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;This will allow me to write enough code to create the &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;class and ensure that it implements the right interface.&lt;/p&gt;
&lt;p&gt;Making the test compile forces me to create a new &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;class (I added it to the fixture as a nested class for the moment), and the test fails.&amp;nbsp; No problem.&amp;nbsp; I add the interface, implement it with methods that throw, and..... We are green again.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;Next step, I copied the unit test &lt;span style="color: green"&gt;RootContainerParentIsNull&lt;/span&gt; over, changed its name to NewUnityContainerParentIsNull, updated it to create a new UnityCompositionContainer, and compiled and ran the test.&amp;nbsp; It passed, which is not idea;l, but I will leave it an move on, knowing it will be important later.&amp;nbsp; For the next test, I copied &lt;span style="color: green"&gt;ChildContainerHasParent &lt;/span&gt;changed its name to NewUnityContainerParentIsNull, updated it to create a new UnityCompositionContainer, and compiled and ran the test... Red. Just like we expected.&amp;nbsp; To make this work, I could do a bit of throw away work, or I could add Unity.&amp;nbsp; I feel like I can skip the simplest thing possible, because I know where I want to go.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;However, first, I'm doing a check-in.&amp;nbsp; I'll comment out the failing test, and sync up.&amp;nbsp; Just a sec.&lt;/p&gt;
&lt;p&gt;&amp;lt;click click&amp;gt;&lt;/p&gt;
&lt;p&gt;Ok, now To add Unity.&amp;nbsp; I grabbed the binaries from MSDN, dropped them in my tree in the Lib folder and we are good to go.&amp;nbsp; I added references in the CWAB projecct to Unity.DLL and ObjectBuilder2.DLL.&amp;nbsp; This means we have two completely separate DI systems as part of out code, which is awful.&amp;nbsp; However, it won't last too long.&lt;/p&gt;
&lt;p&gt;Now, we can make that test pass.&amp;nbsp; I added an IUnityContainer field to UnityCompositionContainer.&amp;nbsp; I then implemented a constructor to initialize it.&amp;nbsp; Then we needed to implement CreateChildContainer.&amp;nbsp; For this, the simplest thing was to create a new constructor for UnityCompositionContainer which takes a parent container as the only parameter.&amp;nbsp; After a little wire-up we end up with passing tests and this code:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private &lt;/span&gt;UnityCompositionContainer(&lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;parentContainer)
{
    Parent = parentContainer;
    wrappedContainer = parentContainer.wrappedContainer.CreateChildContainer();
}&lt;/pre&gt;&lt;/blockquote&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;CreateChildContainer()
{
    &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;child = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;);
    &lt;span style="color: blue"&gt;return &lt;/span&gt;child;
}&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Fairly simple.&amp;nbsp; I will continue moving unit tests over, adapting them, and making them pass.&amp;nbsp; If there are any interesting deviations from normal, or new tests added, I'll let you know.&lt;/p&gt;
&lt;p&gt;&amp;lt;timewarp duration="a short while" /&amp;gt;&lt;/p&gt;
&lt;p&gt;That was actually fairly simple.&amp;nbsp; I copied the tests one at a time, replaced the container used with the UnityCompositionContainer, compiled, ran the tests, watched them fail due to NotImplementedExceptions, and fixed them.&amp;nbsp; Here's the test fixture:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;[&lt;span style="color: #2b91af"&gt;TestClass&lt;/span&gt;]
&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainerFixture
&lt;/span&gt;{
    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;UnityCompositionContainerIsICompositionContainer()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsInstanceOfType(container, &lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ICompositionContainer&lt;/span&gt;));
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;NewUnityContainerParentIsNull()
    {
        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsNull(container.Parent);
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;ChildContainerHasParent()
    {
        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;parent = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();

        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;child = parent.CreateChildContainer();

        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreSame(parent, child.Parent);
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;CanRegisterTypeMappingOnRootContainer()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();

        root.RegisterType&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;();

        &lt;span style="color: #2b91af"&gt;IFoo &lt;/span&gt;resolvedIFoo = root.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;&amp;gt;();

        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;), resolvedIFoo.GetType());
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;CanRegisterTypeMappingViaTypeObjects()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        root.RegisterType(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;), &lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;));

        &lt;span style="color: #2b91af"&gt;IFoo &lt;/span&gt;resolvedIFoo = root.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;&amp;gt;();

        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;), resolvedIFoo.GetType());
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;RequestingTypeMappingForUnmappedTypeReturnsRequestedType()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();

        &lt;span style="color: #2b91af"&gt;Foo &lt;/span&gt;resolvedFoo = root.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;();

        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;), resolvedFoo.GetType());
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    [&lt;span style="color: #2b91af"&gt;ExpectedException&lt;/span&gt;(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;ArgumentException&lt;/span&gt;))]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;TypeMappingsMustBeTypeCompatible()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        root.RegisterType(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;IBar&lt;/span&gt;), &lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;));
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;CanRegisterMultipleTypeMappings()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();

        root.RegisterType&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;();
        root.RegisterType&amp;lt;&lt;span style="color: #2b91af"&gt;IBar&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;Bar&lt;/span&gt;&amp;gt;();
        &lt;span style="color: #2b91af"&gt;IBar &lt;/span&gt;b = root.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;IBar&lt;/span&gt;&amp;gt;();
        &lt;span style="color: #2b91af"&gt;IFoo &lt;/span&gt;f = root.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;&amp;gt;();

        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Bar&lt;/span&gt;), b.GetType());
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;), f.GetType());
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;RequestingTypeMappingOnChildReadsFromParent()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;parent = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;child = (&lt;span style="color: #2b91af"&gt;ICompositionContainer&lt;/span&gt;) parent.CreateChildContainer();

        parent.RegisterType&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;();

        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;), child.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;&amp;gt;().GetType());
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;ChildContainersCanOverrideParentTypeMapping()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;parent = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;child = (&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;) parent.CreateChildContainer();

        parent.RegisterType&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;();
        child.RegisterType&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;Foo2&lt;/span&gt;&amp;gt;();

        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;), parent.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;&amp;gt;().GetType());
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo2&lt;/span&gt;), child.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;IFoo&lt;/span&gt;&amp;gt;().GetType());
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;CanCreateChildContainer()
    {
        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();

        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;child = container.CreateChildContainer();
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsNotNull(child);
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreNotSame(container, child);
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;CanRegisterInstance()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        root.RegisterInstance(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: blue"&gt;string&lt;/span&gt;), &lt;span style="color: #a31515"&gt;"foo"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"bar"&lt;/span&gt;);
        &lt;span style="color: blue"&gt;string &lt;/span&gt;returned = (&lt;span style="color: blue"&gt;string&lt;/span&gt;) root.Resolve(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: blue"&gt;string&lt;/span&gt;), &lt;span style="color: #a31515"&gt;"foo"&lt;/span&gt;);
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: #a31515"&gt;"bar"&lt;/span&gt;, returned);
    }


    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;CanRegisterInstanceViaGenericWithoutName()
    {
        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;Foo &lt;/span&gt;f1 = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;();
        root.RegisterInstance&amp;lt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;(f1);
        &lt;span style="color: #2b91af"&gt;Foo &lt;/span&gt;returnedFoo = (&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;) root.Resolve(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;));
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(f1, returnedFoo);
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;CanRegisterInstanceViaGenericWithName()
    {
        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;Foo &lt;/span&gt;f1 = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;();
        root.RegisterInstance&amp;lt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515"&gt;"asdf"&lt;/span&gt;, f1);
        &lt;span style="color: #2b91af"&gt;Foo &lt;/span&gt;returnedFoo = (&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;) root.Resolve(&lt;span style="color: blue"&gt;typeof &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;), &lt;span style="color: #a31515"&gt;"asdf"&lt;/span&gt;);
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(f1, returnedFoo);
    }


    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;CanResolveViaGenericWithoutName()
    {
        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;Foo &lt;/span&gt;f1 = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;();
        root.RegisterInstance&amp;lt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;(f1);
        &lt;span style="color: #2b91af"&gt;Foo &lt;/span&gt;returnedFoo = root.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;();
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(f1, returnedFoo);
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;CanResolveInstanceViaGenericWithName()
    {
        &lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;root = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;Foo &lt;/span&gt;f1 = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;();
        root.RegisterInstance&amp;lt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515"&gt;"asdf"&lt;/span&gt;, f1);
        &lt;span style="color: #2b91af"&gt;Foo &lt;/span&gt;returnedFoo = root.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;Foo&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515"&gt;"asdf"&lt;/span&gt;);
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(f1, returnedFoo);
    }

    [&lt;span style="color: #2b91af"&gt;TestMethod&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public void &lt;/span&gt;UnityCompositionContainerImplementsIDisposable()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;disposableContainer = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;();
        &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsNotNull(disposableContainer &lt;span style="color: blue"&gt;as &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IDisposable&lt;/span&gt;);
    }

    &lt;span style="color: green"&gt;// This test is commented out intentionally. The purpose of this test is to show 
    // that if you use the generic version of the RegisterTypeMapping method, if the
    // types aren't compatible it'll fail at compile time. 
    // 
    // This is exactly what happens. However that also means this file won't compile.
    // The test is left in as comments, if you wish to verify this then remove the comments,
    // watch the compile file, and then comment it out again.

    //[TestMethod]
    //public void GenericTypeMappingRegistrationEnforcesCompileTimeCompatibility()
    //{
    //    UnityCompositionContainer root = new UnityCompositionContainer();
    //    root.RegisterType&amp;lt;IBar, Foo&amp;gt;();
    //}
&lt;/span&gt;}&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;Notice, there are no tests for the Services collection.&amp;nbsp; This is intentional.&amp;nbsp; We will see if we can avoid implementing the methods at all.&lt;/p&gt;
&lt;p&gt;And here is the code to make those tests pass:&lt;/p&gt;
&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;ICompositionContainer&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;IDisposable
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;parent = &lt;span style="color: blue"&gt;null&lt;/span&gt;;
    &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IUnityContainer &lt;/span&gt;wrappedContainer;

    &lt;span style="color: blue"&gt;public &lt;/span&gt;UnityCompositionContainer()
    {
        wrappedContainer = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityContainer&lt;/span&gt;();
    }

    &lt;span style="color: blue"&gt;private &lt;/span&gt;UnityCompositionContainer(&lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;parentContainer)
    {
        Parent = parentContainer;
        wrappedContainer = parentContainer.wrappedContainer.CreateChildContainer();
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;Parent
    {
        &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;parent; }
        &lt;span style="color: blue"&gt;set &lt;/span&gt;{ parent = &lt;span style="color: blue"&gt;value&lt;/span&gt;; }
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IServiceCollection &lt;/span&gt;Services
    {
        &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;NotImplementedException&lt;/span&gt;(); &lt;span style="color: green"&gt;// return services; 
        &lt;/span&gt;}
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;RegisterInstance(&lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;t, &lt;span style="color: blue"&gt;object &lt;/span&gt;instance)
    {
        wrappedContainer.RegisterInstance(t, instance);
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;RegisterInstance(&lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;t, &lt;span style="color: blue"&gt;string &lt;/span&gt;name, &lt;span style="color: blue"&gt;object &lt;/span&gt;instance)
    {
        wrappedContainer.RegisterInstance(t, name, instance);
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;RegisterInstance&amp;lt;TInterface&amp;gt;(TInterface instance)
    {
        wrappedContainer.RegisterInstance&amp;lt;TInterface&amp;gt;(instance);
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;RegisterInstance&amp;lt;TInterface&amp;gt;(&lt;span style="color: blue"&gt;string &lt;/span&gt;name, TInterface instance)
    {
        wrappedContainer.RegisterInstance&amp;lt;TInterface&amp;gt;(name, instance);
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;RegisterType&amp;lt;TRequested, TReturned&amp;gt;() &lt;span style="color: blue"&gt;where &lt;/span&gt;TReturned : TRequested
    {
        wrappedContainer.RegisterType&amp;lt;TRequested, TReturned&amp;gt;();
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;RegisterType(&lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;requested, &lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;returned)
    {
        wrappedContainer.RegisterType(requested, returned);
    }

    &lt;span style="color: blue"&gt;public object &lt;/span&gt;Resolve(&lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;typeOfItem)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;wrappedContainer.Resolve(typeOfItem);
    }

    &lt;span style="color: blue"&gt;public object &lt;/span&gt;Resolve(&lt;span style="color: #2b91af"&gt;Type &lt;/span&gt;typeOfItem, &lt;span style="color: blue"&gt;string &lt;/span&gt;name)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;wrappedContainer.Resolve(typeOfItem, name);
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;T Resolve&amp;lt;T&amp;gt;()
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;wrappedContainer.Resolve&amp;lt;T&amp;gt;();
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;T Resolve&amp;lt;T&amp;gt;(&lt;span style="color: blue"&gt;string &lt;/span&gt;name)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;wrappedContainer.Resolve&amp;lt;T&amp;gt;(name);
    }

    &lt;span style="color: blue"&gt;public object &lt;/span&gt;BuildItem(&lt;span style="color: #2b91af"&gt;IBuilder&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;WCSFBuilderStage&lt;/span&gt;&amp;gt; builder, &lt;span style="color: blue"&gt;object &lt;/span&gt;item)
    {
        &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;NotImplementedException&lt;/span&gt;();
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ICompositionContainer &lt;/span&gt;CreateChildContainer()
    {
        &lt;span style="color: #2b91af"&gt;UnityCompositionContainer &lt;/span&gt;child = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityCompositionContainer&lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;);
        &lt;span style="color: blue"&gt;return &lt;/span&gt;child;
    }

    &lt;span style="color: blue"&gt;public void &lt;/span&gt;Dispose()
    {
        wrappedContainer.Dispose();
        wrappedContainer = &lt;span style="color: blue"&gt;null&lt;/span&gt;;
    }
}&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;We are now in a green state, time to check in.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Abusing Source Control&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Agile teams usually check in very often.&amp;nbsp; Some teams check in every time they hit green.&amp;nbsp; I think that is a bit of overkill, unless you have a source control system with NO overhead.&amp;nbsp; I check in when I complete a feature or a story, and usually at a few good, green stopping points in the process, like I have been doing.&amp;nbsp; This was a good stopping point, and my next task is a bit risky, so this is a perfect time to check in.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;This is a long enough post, even though I didn't do all that much, that I will call it quits for today.&amp;nbsp; Next post, actually use the UnityCompositionContainer, and then nuke the old CompositionContainer.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8447888" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Example+Driven+Design+_2800_Formerly+TDD_2900_/default.aspx">Example Driven Design (Formerly TDD)</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Web+Client+Software+Factory/default.aspx">Web Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Unity/default.aspx">Unity</category></item><item><title>Smart Client Software Factory – April 2008 Release is available on MSDN</title><link>http://blogs.msdn.com/mpuleio/archive/2008/04/25/smart-client-software-factory-april-2008-release-is-available-on-msdn.aspx</link><pubDate>Sat, 26 Apr 2008 03:25:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8425078</guid><dc:creator>mpuleio</dc:creator><slash:comments>5</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8425078.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8425078</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8425078</wfw:comment><description>&lt;P&gt;The April 2008 release of the Smart Client Software Factory is now available at &lt;A href="http://msdn2.microsoft.com/en-us/library/aa480482.aspx" target=_blank&gt;&lt;FONT color=#0000ff&gt;http://msdn2.microsoft.com/en-us/library/aa480482.aspx&lt;/FONT&gt;&lt;/A&gt;.&amp;nbsp; &lt;/P&gt;
&lt;P&gt;This is a port of the last release&amp;nbsp;(May 2007,&amp;nbsp;if I recall&amp;nbsp;correctly)&amp;nbsp;to VS2008.&amp;nbsp; No new features were added.&amp;nbsp; A few bugs were fixed, and a number of work items from CodePlex were closed.&lt;/P&gt;
&lt;P&gt;This release supports Enterprise Library 3.1.&amp;nbsp; It does not support Enterprise Library 4.0.&amp;nbsp; If you want EntLib 4.0 (once it is released) you have the source code, and should be able to get it to work, if you really need to.&amp;nbsp; I would not recommend it, as you will end up with two containers (Unity and the CAB container), which means code bloat and challenges deciding where objects should go.&lt;/P&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8425078" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Example+Driven+Design+_2800_Formerly+TDD_2900_/default.aspx">Example Driven Design (Formerly TDD)</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Smart+Client+Software+Factory/default.aspx">Smart Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Converting the Composite Web Application Block to Unity - Ummmm...Oooops.</title><link>http://blogs.msdn.com/mpuleio/archive/2008/04/22/converting-the-composite-web-application-block-to-unity-ummmm-oooops.aspx</link><pubDate>Wed, 23 Apr 2008 02:57:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8417509</guid><dc:creator>mpuleio</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8417509.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8417509</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8417509</wfw:comment><description>&lt;P&gt;This is the forth post in a series. The other post include 
&lt;UL&gt;
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/mpuleio/archive/2008/04/04/converting-the-composite-web-application-block-to-unity-intro.aspx" mce_href="http://blogs.msdn.com/mpuleio/archive/2008/04/04/converting-the-composite-web-application-block-to-unity-intro.aspx"&gt;Converting the Composite Web Application Block to Unity - Intro&lt;/A&gt;. 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/mpuleio/archive/2008/04/04/converting-the-composite-web-application-block-to-unity-adding-an-icompositioncontainer.aspx" target=_blank mce_href="http://blogs.msdn.com/mpuleio/archive/2008/04/04/converting-the-composite-web-application-block-to-unity-adding-an-icompositioncontainer.aspx"&gt;Converting the Composite Web Application Block to Unity - Adding an ICompositionContainer&lt;/A&gt; 
&lt;LI&gt;&lt;A href="http://blogs.msdn.com/mpuleio/archive/2008/04/09/converting-the-composite-web-application-block-to-unity-clean-up-icompositioncontainer.aspx" mce_href="http://blogs.msdn.com/mpuleio/archive/2008/04/09/converting-the-composite-web-application-block-to-unity-clean-up-icompositioncontainer.aspx"&gt;Converting the Composite Web Application Block to Unity - Clean Up ICompositionContainer&lt;/A&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;If you want background, go read the earlier posts. 
&lt;P&gt;Based upon feedback, I am making the source code available at &lt;A title=http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity href="http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity" target=_blank mce_href="http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity"&gt;CWAB and Unity&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;In the last installment I wanted to remove the following from the ICompositionContainer:&lt;/P&gt;
&lt;UL&gt;
&lt;LI&gt;&lt;STRIKE&gt;static methods &lt;/STRIKE&gt;
&lt;LI&gt;&lt;STRIKE&gt;Builder &lt;/STRIKE&gt;
&lt;LI&gt;&lt;STRIKE&gt;Locator &lt;/STRIKE&gt;
&lt;LI&gt;&lt;STRIKE&gt;Containers &lt;/STRIKE&gt;
&lt;LI&gt;Services&lt;/LI&gt;&lt;/UL&gt;
&lt;P&gt;We completed the first four. In this installment, we will remove the Services collection, replacing it with using RegisterInstance and Resolve. After that, we will compare our ICompositionContainer to IUnityContainer, see what else we need to do, and may even pull in Unity. 
&lt;H3&gt;Adding a few new methods&lt;/H3&gt;
&lt;P&gt;Before we do this, I want to add a generic overload to Resolve and one to RegisterInstance.&amp;nbsp; I like the way the generic calls on Unity look, compared to all the typeof() and casting we have done so far.&amp;nbsp; 
&lt;P&gt;I added the following tests, one at a time, and made them pass: 
&lt;BLOCKQUOTE&gt;&lt;PRE class=code&gt;[&lt;SPAN style="COLOR: #2b91af"&gt;TestMethod&lt;/SPAN&gt;]
&lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;CanRegisterInstanceViaGenericWithoutName()
{
    &lt;SPAN style="COLOR: #2b91af"&gt;ICompositionContainer &lt;/SPAN&gt;root = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TestableRootCompositionContainer&lt;/SPAN&gt;();
    &lt;SPAN style="COLOR: #2b91af"&gt;Foo &lt;/SPAN&gt;f1 = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;();
    root.RegisterInstance&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;&amp;gt;(f1);
    &lt;SPAN style="COLOR: #2b91af"&gt;Foo &lt;/SPAN&gt;returnedFoo = (&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;)root.Resolve(&lt;SPAN style="COLOR: blue"&gt;typeof&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;));
    &lt;SPAN style="COLOR: #2b91af"&gt;Assert&lt;/SPAN&gt;.AreEqual(f1, returnedFoo);
}

[&lt;SPAN style="COLOR: #2b91af"&gt;TestMethod&lt;/SPAN&gt;]
&lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;CanRegisterInstanceViaGenericWithName()
{
    &lt;SPAN style="COLOR: #2b91af"&gt;ICompositionContainer &lt;/SPAN&gt;root = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TestableRootCompositionContainer&lt;/SPAN&gt;();
    &lt;SPAN style="COLOR: #2b91af"&gt;Foo &lt;/SPAN&gt;f1 = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;();
    root.RegisterInstance&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;&amp;gt;(&lt;SPAN style="COLOR: #a31515"&gt;"asdf"&lt;/SPAN&gt;, f1);
    &lt;SPAN style="COLOR: #2b91af"&gt;Foo &lt;/SPAN&gt;returnedFoo = (&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;)root.Resolve(&lt;SPAN style="COLOR: blue"&gt;typeof&lt;/SPAN&gt;(&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;), &lt;SPAN style="COLOR: #a31515"&gt;"asdf"&lt;/SPAN&gt;);
    &lt;SPAN style="COLOR: #2b91af"&gt;Assert&lt;/SPAN&gt;.AreEqual(f1, returnedFoo);
}


[&lt;SPAN style="COLOR: #2b91af"&gt;TestMethod&lt;/SPAN&gt;]
&lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;CanResolveViaGenericWithoutName()
{
    &lt;SPAN style="COLOR: #2b91af"&gt;ICompositionContainer &lt;/SPAN&gt;root = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TestableRootCompositionContainer&lt;/SPAN&gt;();
    &lt;SPAN style="COLOR: #2b91af"&gt;Foo &lt;/SPAN&gt;f1 = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;();
    root.RegisterInstance&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;&amp;gt;(f1);
    &lt;SPAN style="COLOR: #2b91af"&gt;Foo &lt;/SPAN&gt;returnedFoo = root.Resolve&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;&amp;gt;();
    &lt;SPAN style="COLOR: #2b91af"&gt;Assert&lt;/SPAN&gt;.AreEqual(f1, returnedFoo);
}

[&lt;SPAN style="COLOR: #2b91af"&gt;TestMethod&lt;/SPAN&gt;]
&lt;SPAN style="COLOR: blue"&gt;public void &lt;/SPAN&gt;CanResolveInstanceViaGenericWithName()
{
    &lt;SPAN style="COLOR: #2b91af"&gt;ICompositionContainer &lt;/SPAN&gt;root = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;TestableRootCompositionContainer&lt;/SPAN&gt;();
    &lt;SPAN style="COLOR: #2b91af"&gt;Foo &lt;/SPAN&gt;f1 = &lt;SPAN style="COLOR: blue"&gt;new &lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;();
    root.RegisterInstance&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;&amp;gt;(&lt;SPAN style="COLOR: #a31515"&gt;"asdf"&lt;/SPAN&gt;, f1);
    &lt;SPAN style="COLOR: #2b91af"&gt;Foo &lt;/SPAN&gt;returnedFoo = root.Resolve&amp;lt;&lt;SPAN style="COLOR: #2b91af"&gt;Foo&lt;/SPAN&gt;&amp;gt;(&lt;SPAN style="COLOR: #a31515"&gt;"asdf"&lt;/SPAN&gt;);
    &lt;SPAN style="COLOR: #2b91af"&gt;Assert&lt;/SPAN&gt;.AreEqual(f1, returnedFoo);
}&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P mce_keep="true"&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In making them pass, I added the following to the ICompositionContainer interface:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;PRE class=code&gt;T Resolve&amp;lt;T&amp;gt;();
T Resolve&amp;lt;T&amp;gt;(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;name);
&lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;RegisterInstance&amp;lt;TInterface&amp;gt;(TInterface instance);
&lt;SPAN style="COLOR: blue"&gt;void &lt;/SPAN&gt;RegisterInstance&amp;lt;TInterface&amp;gt;(&lt;SPAN style="COLOR: blue"&gt;string &lt;/SPAN&gt;name, TInterface instance);&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;&lt;A href="http://11011.net/software/vspaste" mce_href="http://11011.net/software/vspaste"&gt;&lt;/A&gt;
&lt;P&gt;This will help a bit with the look, feel, and style of the code, now for the real work.&lt;/P&gt;
&lt;H3&gt;Removing the Services Collection&lt;/H3&gt;
&lt;P&gt;Why do we want to remove the Services collection?&amp;nbsp; Since Unity handles this sort of functionality, we can offload it entirely to Unity.&amp;nbsp; This will cut a bit of code out of our implementation. 
&lt;P&gt;Let's do this the simple way, (I like to call it hack and slash development) and just remove the Services collection from the ICompositionContainer interface.&amp;nbsp; This will result in a number of build errors (twenty or so, in fact).&amp;nbsp; However, we can fix each of them easily.&amp;nbsp; Any call to add a service becomes a RegisterInstance call, and any call to get a service becomes a Resolve call.&amp;nbsp; So, we will hack each problem until we are in a green state again.&amp;nbsp; The other option, for the less daring, is to search for all uses of Services, change them one at a time, and make sure we are green at each step.&amp;nbsp; Today, I am feeling brave (read: reckless, or overly caffeinated), so I took the other approach.&amp;nbsp; If I were pairing with someone, they would probably stop me. :-) 
&lt;P&gt;Once CWAB compiles, we still need to get the unit test library to compile.&amp;nbsp; &amp;lt;click click click&amp;gt; &amp;lt;swear&amp;gt; &amp;lt;click click click&amp;gt;.&amp;nbsp; The biggest challenge here is that Services.AddNew&amp;lt;T, IT&amp;gt; and RegisterType&amp;lt;IT, T&amp;gt; have the generic parameters in reversed order.&amp;nbsp; Aaargh. 
&lt;P&gt;Everything compiles, but I have a problem: 34 unit tests are failing.&amp;nbsp; This is not optimal.&amp;nbsp; Now, why are they failing?&amp;nbsp; After looking at the first few, it looks like I removed Services from the interface, and forgot to remove it from the CompositionContainer.&amp;nbsp; The result is that some tests are still using the ServicesCollection.&amp;nbsp; Oooops. 
&lt;P&gt;After removing Services from CompostionContainer, and getting everything to compile again, the test results are..... 
&lt;P&gt;Ouch!&amp;nbsp; 40 failing unit tests.&amp;nbsp; That is not good. 
&lt;P&gt;However, after some investigation, I can remove a couple of classes from our solution, as they are no longer necessary, and are just causing problems. 
&lt;BLOCKQUOTE&gt;&lt;PRE class=code&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ServiceDependencyParameterResolver&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ProviderDependencyParameterResolver&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ProviderDependencyAttribute&lt;BR&gt;&lt;/SPAN&gt;&lt;SPAN style="COLOR: #2b91af"&gt;ServiceDependencyAttribute&lt;/SPAN&gt;&lt;/PRE&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;After removing them, there is a bit of code cleanup required, to remove references.&amp;nbsp; All of the ServiceDependencyAttributes I replaced with ObjectBuilder DependencyAttributes.&amp;nbsp; The ProviderAttributes, I commented out for the moment.&lt;/P&gt;
&lt;P&gt;Wow. Progress. we are down to 37 failing tests. After looking at a few of them, where instances were not the same, I changed the SingletonPolicy in Resolve, and we are down to 24 failing tests. 
&lt;P&gt;Oh, gotta take a break. 
&lt;P&gt;&amp;lt;TimeWarp&amp;gt;Several Days Fly By&amp;lt;/TimeWarp&amp;gt; 
&lt;P&gt;I got interrupted from getting this working the other day.&amp;nbsp; Now, I am starting with broken tests.&amp;nbsp; I hate that.&amp;nbsp; I guess I was a bit too reckless.&amp;nbsp; Well, I have a few options: 
&lt;OL&gt;
&lt;LI&gt;I can continue and see this through 
&lt;LI&gt;I can timebox to a hour, and then roll back, and try again by taking smaller steps 
&lt;LI&gt;I can give up now and try again from the last known good state.&lt;/LI&gt;&lt;/OL&gt;
&lt;P&gt;I am going to opt for number 1.5: timebox to two hours, and depending on where I am, make a decision. 
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;lt;timewarp duration="1 hour" /&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;@#$%^%$#@#$!!! &lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;&amp;lt;timewarp duration="a few days" reason="I needed to think about it" /&amp;gt;&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I have determined that I got a bit overzealous.&amp;nbsp; For the moment, the Services collection is necessary, and we can remove it once we have Unity in place to provide the necessary functionality.&amp;nbsp; It will stay as part of the interface, and will continue to provide functionality until we no longer need it.&amp;nbsp; However, it will eventually go away.&amp;nbsp; How did I arrive at this conclusion?&amp;nbsp; Well, I could not get the failing unit tests to pass in a reasonable amount of time.&amp;nbsp; Moving the functionality requires a lot more code than is really practical for throw-away code.&amp;nbsp; Oooops.&amp;nbsp; Everyone makes mistakes.&amp;nbsp; 
&lt;P&gt;As a result, I need to roll back a lot of changes.&amp;nbsp; Unfortunately, I did not back up everything (or do a check in) before starting down the path of removing the services collection.&amp;nbsp; Net result: I need to roll back everything, and then re-do the first half of this article. Double @#%$@%!&lt;/P&gt;
&lt;P&gt;I'll revert and then rework the code up to the section &lt;EM&gt;Removing the Services Collection&lt;/EM&gt;.&amp;nbsp; I'll get the code posted (&lt;A href="http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity" target=_blank mce_href="http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity"&gt;with the other source code&lt;/A&gt;) before I start the next installment.&lt;/P&gt;
&lt;P&gt;However, I wanted to post this article sooner rather than later, so folks don't think I have dropped the series.&amp;nbsp; Enjoy.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8417509" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Example+Driven+Design+_2800_Formerly+TDD_2900_/default.aspx">Example Driven Design (Formerly TDD)</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Web+Client+Software+Factory/default.aspx">Web Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Unity/default.aspx">Unity</category></item><item><title>Smart Client Software Factory April 2008 Release Candidate Available</title><link>http://blogs.msdn.com/mpuleio/archive/2008/04/21/smart-client-software-factory-april-2008-release-candidate-available.aspx</link><pubDate>Tue, 22 Apr 2008 00:09:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8415422</guid><dc:creator>mpuleio</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8415422.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8415422</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8415422</wfw:comment><description>&lt;P&gt;Friday, I posted we had a solid Beta.&amp;nbsp; Today, I am letting you know that &lt;A href="http://www.codeplex.com/smartclient/Release/ProjectReleases.aspx?ReleaseId=12765" target=_blank mce_href="http://www.codeplex.com/smartclient/Release/ProjectReleases.aspx?ReleaseId=12765"&gt;SCSF now has a Release Candidate (RC)&lt;/A&gt;.&amp;nbsp; The bug that appeared Friday is, we think, fixed.&amp;nbsp; We actually published the RC before we completed any internal testing, so the customer who reported the issue would have a chance to verify the fix works on their system ASAP.&amp;nbsp; Don't worry, we will&amp;nbsp;do a&amp;nbsp;solid test pass before determining if&amp;nbsp;this RC will become&amp;nbsp;the official release.&amp;nbsp;(The fact that we are confident in our build system and the automated tests there helps with this sort of turnaround. :-) ) &lt;/P&gt;
&lt;P&gt;Please try out the &lt;A href="http://www.codeplex.com/smartclient/Release/ProjectReleases.aspx?ReleaseId=12765" target=_blank mce_href="http://www.codeplex.com/smartclient/Release/ProjectReleases.aspx?ReleaseId=12765"&gt;Smart Client Software Factory April 2008 Release Candidate,&lt;/A&gt; and report any issues on the &lt;A href="http://www.codeplex.com/smartclient" target=_blank mce_href="http://www.codeplex.com/smartclient"&gt;SCSF CodePlex community site&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8415422" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Smart+Client+Software+Factory/default.aspx">Smart Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Smart Client Software Factory April 2008 Beta Available</title><link>http://blogs.msdn.com/mpuleio/archive/2008/04/18/smart-client-software-factory-april-2008-beta-available.aspx</link><pubDate>Sat, 19 Apr 2008 01:34:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8409262</guid><dc:creator>mpuleio</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8409262.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8409262</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8409262</wfw:comment><description>&lt;p&gt;The &lt;a href="http://www.codeplex.com/smartclient/Release/ProjectReleases.aspx?ReleaseId=12699"&gt;SCSF April 2008 Beta Release&lt;/a&gt; that supports Visual Studio 2008 is now available.&lt;/p&gt; &lt;p&gt;We fixed all the known issues from the Alpha.&amp;nbsp; It is &lt;strong&gt;solid&lt;/strong&gt;, and may actually be a release candidate, rather than a beta.&lt;/p&gt; &lt;p&gt;Enjoy.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8409262" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Smart+Client+Software+Factory/default.aspx">Smart Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Smart Client Software Factory April 2008 Alpha Available</title><link>http://blogs.msdn.com/mpuleio/archive/2008/04/10/smart-client-software-factory-april-2008-alpha-available.aspx</link><pubDate>Fri, 11 Apr 2008 01:16:03 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8376894</guid><dc:creator>mpuleio</dc:creator><slash:comments>4</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8376894.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8376894</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8376894</wfw:comment><description>&lt;p&gt;For the past month or so, Blaine and I have been &lt;em&gt;overseeing&lt;/em&gt; the development of the April release of the Smart Client Software Factory.&amp;nbsp; This release is being done mostly by a team of vendors, freeing Blaine to run Prism and I to run the Acceptance Testing Guidance project.&amp;nbsp; Blaine and I are still very involved, and I still review code changes at random, but the team does most of the work.&amp;nbsp; The team has been doing a great job, and I think the community will be pleased with the results.&lt;/p&gt; &lt;p&gt;This is a port of SCSF to VS2008 and the .NET 3.5 framework.&amp;nbsp; It uses Enterprise Library 3.1, not 4.0, intentionally.&amp;nbsp; There is very little in 4.0 that will effect CAB and SCSF development, except Unity.&amp;nbsp; Using Unity would require a nearly full re-write of CAB, and we don't currently have the time or people to do it right and deliver on our other commitments.&amp;nbsp; However, if you really need EntLib4.0, it should work, and if not, you have the source code to fix it.&lt;/p&gt; &lt;p&gt;We did need to create a custom data provider to wrap the SqlCE functionality, as the version number of the platform DLL went from 9.x to 3.5.&amp;nbsp; This replaces the EntLib 3.1 provider for SQLCE.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Also, this version of SCSF, just like the last one, supports hosting WPF controls in your WinForms CAB application.&amp;nbsp; It does not support a full WPF app.&amp;nbsp; For that, you want to see &lt;a href="http://www.codeplex.com/prism" target="_blank"&gt;Prism&lt;/a&gt; or the Smart Client Factory Contrib project on CodePlex.&lt;/p&gt; &lt;p&gt;We are also fixing a few bugs, and updating the guidance package (Visual Studio automation) to work in VS2008.&lt;/p&gt; &lt;p&gt;You can &lt;a href="https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=smartclient&amp;amp;ReleaseId=12468" target="_blank"&gt;download the Alpha release&lt;/a&gt; from the &lt;a href="http://www.codeplex.com/smartclient" target="_blank"&gt;SCSF CodePlex community site&lt;/a&gt;.&amp;nbsp; &lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;&lt;strong&gt;&lt;em&gt;Warning&lt;/em&gt;&lt;/strong&gt;: This is an Alpha.&amp;nbsp; We did a &lt;em&gt;minimal&lt;/em&gt; amount of testing ("It compiles and links."&amp;nbsp; -- "Good enough.&amp;nbsp; Ship it"), and the computer we installed it on still boots, still runs VS, and &lt;em&gt;seems&lt;/em&gt; ok.&amp;nbsp; Use at your own risk.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;We are trying to get this project wrapped up this month.&amp;nbsp; If you see issues, please post them to the Issue Tracker at the &lt;a href="http://www.codeplex.com/smartclient" target="_blank"&gt;SCSF CodePlex community site&lt;/a&gt;, and/or post to the discussion forum there.&amp;nbsp; We will try to get any major problems, but will not be adding features.&lt;/p&gt; &lt;p&gt;Blaine is also posting about this &lt;a href="http://blogs.msdn.com/blaine/archive/2008/04/10/scsf-april-2008-alpha-for-visual-studio-2008-published-to-codeplex.aspx" target="_blank"&gt;SCSF April 2008 Alpha for Visual Studio 2008 Published to CodePlex&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8376894" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Smart+Client+Software+Factory/default.aspx">Smart Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/WPF/default.aspx">WPF</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Windows+Forms/default.aspx">Windows Forms</category></item><item><title>Unity Shipped</title><link>http://blogs.msdn.com/mpuleio/archive/2008/04/08/unity-shipped.aspx</link><pubDate>Wed, 09 Apr 2008 02:06:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8370334</guid><dc:creator>mpuleio</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8370334.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8370334</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8370334</wfw:comment><description>&lt;p&gt;I am a little late to the party, but &lt;a href="http://www.codeplex.com/unity" target="_blank"&gt;Unity&lt;/a&gt; shipped last week.&lt;/p&gt; &lt;p&gt;Here are a few other posts about it:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Grigori: &lt;a href="http://blogs.msdn.com/agile/archive/2008/04/04/unity-di-container-1-0-shipped.aspx"&gt;Unity DI container 1.0 shipped!&lt;/a&gt;&lt;/li&gt; &lt;li&gt;Chris: &lt;a href="http://www.tavaresstudios.com/Blog/post/Unity-10-is-released!.aspx"&gt;Unity 1.0 is released!&lt;/a&gt;&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;I have used Unity in an internal project here at p&amp;amp;p, as well as a proof of concept re-write of CWAB using Unity.&amp;nbsp; The interface is clean and simple.&amp;nbsp; It does what you want.&amp;nbsp; Configuration is easy.&amp;nbsp; It makes unit testing simpler via de-coupling. &lt;strong&gt;&lt;em&gt;Unity rocks.&amp;nbsp; &lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8370334" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Example+Driven+Design+_2800_Formerly+TDD_2900_/default.aspx">Example Driven Design (Formerly TDD)</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Converting the Composite Web Application Block to Unity - Intro</title><link>http://blogs.msdn.com/mpuleio/archive/2008/04/04/converting-the-composite-web-application-block-to-unity-intro.aspx</link><pubDate>Fri, 04 Apr 2008 23:19:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8358223</guid><dc:creator>mpuleio</dc:creator><slash:comments>10</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8358223.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8358223</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8358223</wfw:comment><description>&lt;P&gt;A few weeks ago, I decided I needed to play with the &lt;A href="http://www.codeplex.com/unity" target=_blank mce_href="http://www.codeplex.com/unity"&gt;Unity Dependency Injection container&lt;/A&gt;. I wanted to see how Chris and the rest of the team had designed it and see how usable the container was. I had seen requests on the &lt;A href="http://www.codeplex.com/websf" target=_blank mce_href="http://www.codeplex.com/websf"&gt;Web Client Software Factory&lt;/A&gt; project's CodePlex site asking for a Unity version of WCSF. Put the two together, and I have a side project, a proof of concept I can legitimately do at work. My eventual end goal is to have the Order Management RI working with a new, Unity-based version of CWAB. 
&lt;P&gt;So, I sat down a few Saturdays ago, with CWAB, an early drop of Unity, and started working. After about eight hours I had the basics of CWAB working: there was a container, and a module loader, global services, and module level services. About 3 hours was used figuring out Unity, the differences between it and the container we created for CWAB (CompositionContainer) , and how to get around them. The rest was work, finding bugs in Unity (I filed a few the next day), and quite a lot of fun. 
&lt;P&gt;Since then, I have added a few more features, made some forwards progress, and lost ground after being overly optimistic about the impact of a few changes. 
&lt;P&gt;Now that I have learned a bit, I wanted to share the information with folks who might be interested in doing this themselves. Rather than trying to remember what I did the first time around, I am going to start over, take a different approach, document what I do as I go, and make a few posts out of this. 
&lt;BLOCKQUOTE&gt;
&lt;P&gt;Please keep in mind, none of this is tested.&amp;nbsp; Use at your own risk.&amp;nbsp; No Support Available.&amp;nbsp; Danger, Will Robinson!&amp;nbsp; Danger!&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;This is a proof of concept that I am fairly certain will work, but I am not 100% certain. We will find out as we go. Oh, and I guarantee that there will be breaking changes. 
&lt;P&gt;My strategy will be to take the existing CWAB DLL and its unit tests, refactor the container behind an interface, modify the interface to nearly match Unity, and then drop Unity in replacing one implementation of the interface with another. After I get CWAB building and the unit tests passing with Unity, I will open up the code for the RI, replace references, and get it to work. 
&lt;P&gt;I will do all of this in an example-driven &lt;STRIKE&gt;test driven&lt;/STRIKE&gt; manner. I am sure I will cheat on occasion, but I will try to be honest and point it out when I do, as well as a reason why. &lt;/P&gt;
&lt;P&gt;EDIT: Based upon feedback, I am making the source code available at &lt;A title=http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity href="http://www.codeplex.com/websf/Wiki/View.aspx?title=CWAB%20and%20Unity" target=_blank&gt;&lt;STRONG&gt;&lt;FONT color=#006bad&gt;CWAB and Unity&lt;/FONT&gt;&lt;/STRONG&gt;&lt;/A&gt;.&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8358223" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Web+Client+Software+Factory/default.aspx">Web Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category></item><item><title>Data-mining for Code Quality Metrics</title><link>http://blogs.msdn.com/mpuleio/archive/2008/04/02/data-mining-for-code-quality-metrics.aspx</link><pubDate>Thu, 03 Apr 2008 02:30:48 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8352663</guid><dc:creator>mpuleio</dc:creator><slash:comments>1</slash:comments><comments>http://blogs.msdn.com/mpuleio/comments/8352663.aspx</comments><wfw:commentRss>http://blogs.msdn.com/mpuleio/commentrss.aspx?PostID=8352663</wfw:commentRss><wfw:comment>http://blogs.msdn.com/mpuleio/rsscomments.aspx?PostID=8352663</wfw:comment><description>&lt;p&gt;I spent two weeks between full time projects (still working on the 2 part time projects I am on) looking back at the build logs from the past 6 months (or so) trying to figure out what metrics we have, what we should track going forward, and what goals we should have for these metrics.&amp;nbsp;&amp;nbsp; I came up with some interesting findings.&lt;/p&gt; &lt;p&gt;First, overall unit test code coverage was OK, but not as high as I would like on my projects.&amp;nbsp; Of course, these numbers included generated code, view code, and other things that I usually filter out.&amp;nbsp; Also coverage was fairly flat.&amp;nbsp; For the most part, as we added code, we added tests.&amp;nbsp; This, I think is much better than one of the alternatives, having coverage drop over the course of the project.&lt;/p&gt; &lt;p&gt;Here is coverage for the Application Blocks in WCSF, without axis labels.&amp;nbsp; The Y axis starts at 76% (not zero).&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mpuleio/WindowsLiveWriter/CodeQualityMetrics_BA15/image_4.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="589" alt="image" src="http://blogs.msdn.com/blogfiles/mpuleio/WindowsLiveWriter/CodeQualityMetrics_BA15/image_thumb_1.png" width="1028" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;You will see that there was a noticeable drop in coverage part way through the project. That was when we added a new library of AJAX controls.&amp;nbsp; Before the change was made we knew this would happen and accepted the risk.&amp;nbsp; I also worked with the testers on my team to mitigate the risk via more acceptance tests and careful code reviews. And after the change, we trended up, slowly, over time.&lt;/p&gt; &lt;p&gt;In addition to watching coverage over time, I was able to come up with a few indices to watch going forward.&amp;nbsp; Thanks to &lt;a href="http://www.ndepend.com/" target="_blank"&gt;NDepend&lt;/a&gt;, a little bit of work parsing build logs, and Linq, I was able to create seven indices, three of which I will be watching closely on future projects:&lt;/p&gt; &lt;ul&gt; &lt;li&gt;Cyclomatic Complexity&lt;/li&gt; &lt;li&gt;Afferent Coupling&lt;/li&gt; &lt;li&gt;Efferent Coupling&lt;/li&gt;&lt;/ul&gt; &lt;p&gt;If you want a definition for any of these, check out the NDepend site.&amp;nbsp; The index for each of these is the average of the top 10 worst values by type.&lt;/p&gt; &lt;p&gt;Here is a graph of these indices over time for another, un-named project (without the axis labels)&lt;/p&gt; &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/mpuleio/WindowsLiveWriter/CodeQualityMetrics_BA15/image_2.png"&gt;&lt;img style="border-right: 0px; border-top: 0px; border-left: 0px; border-bottom: 0px" height="772" alt="image" src="http://blogs.msdn.com/blogfiles/mpuleio/WindowsLiveWriter/CodeQualityMetrics_BA15/image_thumb.png" width="1021" border="0"&gt;&lt;/a&gt; &lt;/p&gt; &lt;p&gt;&amp;nbsp;&lt;/p&gt; &lt;p&gt;You can see that the first few builds did not have NDepend hooked up properly.&amp;nbsp; Then everything tracks along, relatively stable until about 40% through the project.&amp;nbsp; The Dev Lead on the project was able to tell me what happened on the day that the Cyclomatic Complexity dropped drastically.&amp;nbsp; It was a big change to simplify things.&lt;/p&gt; &lt;p&gt;Do these graphs, numbers, and indices (and all the others that I pulled from the data, but did not share yet) tell me the whole story as far as code quality?&amp;nbsp; &lt;em&gt;&lt;strong&gt;Of course not&lt;/strong&gt;&lt;/em&gt;.&amp;nbsp; However, these can all be used as indicators.&amp;nbsp; If complexity trends sharply up over time, there may be a problem we need to investigate.&amp;nbsp; If it stays low, there can still be other problems hidden.&amp;nbsp; However, a little information is better than none.&lt;/p&gt; &lt;p&gt;Now, on to the next project...&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8352663" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Example+Driven+Design+_2800_Formerly+TDD_2900_/default.aspx">Example Driven Design (Formerly TDD)</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Development+Tools/default.aspx">Development Tools</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Agile/default.aspx">Agile</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/patterns+_2600_amp_3B00_+practices/default.aspx">patterns &amp;amp; practices</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/Web+Client+Software+Factory/default.aspx">Web Client Software Factory</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET/default.aspx">ASP.NET</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/ASP.NET+AJAX/default.aspx">ASP.NET AJAX</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://blogs.msdn.com/mpuleio/archive/tags/.NET/default.aspx">.NET</category></item></channel></rss>