<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">
    <channel>
        <title>Insert Catchy Title Here</title>
        <link>http://blechie.com/WPierce/Default.aspx</link>
        <description>Work to Live. Live to Code.</description>
        <language>en-US</language>
        <copyright>Bill Pierce</copyright>
        <managingEditor>wcpierce@gmail.com</managingEditor>
        <generator>Subtext Version 1.9.4.78</generator>
        <image>
            <title>Insert Catchy Title Here</title>
            <url>http://blechie.com/images/RSS2Image.gif</url>
            <link>http://blechie.com/WPierce/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://spaces.msn.com/wcpierce/feed.rss" type="application/rss+xml" /><item>
            <title>SSMS Execution Plan &amp;ndash; Insert Index Here</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/2UVZbeuU6DE/SSMS-Execution-Plan-ndash-Insert-Index-Here.aspx</link>
            <description>&lt;p&gt;I was troubleshooting a performance issue with a particular stored procedure in our application.  Myself being a developer my thought process is DB Performance Issue =&amp;gt; Add an Index.  That is about the extent of my knowledge and when that doesn’t work I stop questioning what exactly it is that a DBA does :)  To figure out where an index is needed I would usually zero in on WHERE clauses and make sure any filtered columns are indexed.   The problem is this stored procedure was ginormous and called several other sprocs on its path to destruction.  So, I thought I’d check out the execution plan.  So I was using SSMS 2005 because that is what was installed on the machine I was remoted in to.  Problem was the execution plan looks like it was a collaboration of Dr. Seuss and MC Escher.  I didn’t want to tie up the server so I saved the execution plan and copied it down to my local machine (the plan was over 1MB so you feel my pain).  I tried to grok the plan for a while but didn’t have any luck so I decided to run the sproc with the troublesome parameters on my local box to see if the performance was bad locally.  I run SSMS 2008 on my local machine and when I ran the query with the execution plan turned on, lo and behold, the Execution Plan told me in bright green letters “Hey idiot stick, you are missing an index on Table X with Columns (Y and Z) Include (A, B, C).”  Needless to say I thought this was an awesome feature and sure enough, adding the index as directed solved the performance problem.&lt;/p&gt;
&lt;p&gt;If you are running SSMS 2008, you can repro the behavior by running the below script to create some data:&lt;/p&gt;
&lt;pre class="sql" name="code"&gt;CREATE TABLE IndexMe(Guid UNIQUEIDENTIFIER NOT NULL)
GO

SET NOCOUNT ON

BEGIN TRAN

INSERT INTO IndexMe(Guid)
VALUES(NEWID())

DECLARE @i INT; SET @i = 0;

WHILE @i &amp;lt; 21 BEGIN
  INSERT INTO IndexMe(Guid)
  SELECT NEWID() FROM IndexMe
  SET @i = @i + 1
END

COMMIT TRAN
GO
&lt;/pre&gt;
&lt;p&gt;Now, turn on the Execution Plan in the Query Analyzer and run this query:&lt;/p&gt;
&lt;pre class="sql" name="code"&gt;SELECT * FROM IndexMe WHERE Guid &amp;gt; '889327B7-966E-4288-A459-EEE4EEA9D109'
&lt;/pre&gt;
&lt;p&gt;You should be presented with something like so:&lt;/p&gt;
&lt;p&gt;&lt;a rel="lightbox" href="http://blechie.com/images/blechie_com/WPierce/WindowsLiveWriter/SSMSExecutionPlanInsertIndexHere_9907/SSMS2008_2.png"&gt;&lt;img style="BORDER-RIGHT-WIDTH: 0px; DISPLAY: inline; BORDER-TOP-WIDTH: 0px; BORDER-BOTTOM-WIDTH: 0px; BORDER-LEFT-WIDTH: 0px" title="SSMS2008" border="0" alt="SSMS2008" width="644" height="285" src="http://blechie.com/images/blechie_com/WPierce/WindowsLiveWriter/SSMSExecutionPlanInsertIndexHere_9907/SSMS2008_thumb.png" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;The “Missing Index” tells you exactly what you need to do for your query to suck less.&lt;/p&gt;&lt;img src="http://blechie.com/WPierce/aggbug/404.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LDT4Y4fi6OhzuqcgGfDdDHcaj74/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LDT4Y4fi6OhzuqcgGfDdDHcaj74/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/LDT4Y4fi6OhzuqcgGfDdDHcaj74/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LDT4Y4fi6OhzuqcgGfDdDHcaj74/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=2UVZbeuU6DE:oQbxyATxU1k:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=2UVZbeuU6DE:oQbxyATxU1k:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=2UVZbeuU6DE:oQbxyATxU1k:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=2UVZbeuU6DE:oQbxyATxU1k:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=2UVZbeuU6DE:oQbxyATxU1k:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=2UVZbeuU6DE:oQbxyATxU1k:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/2UVZbeuU6DE" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/12/24/SSMS-Execution-Plan-ndash-Insert-Index-Here.aspx</guid>
            <pubDate>Wed, 24 Dec 2008 18:52:59 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/404.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/12/24/SSMS-Execution-Plan-ndash-Insert-Index-Here.aspx#feedback</comments>
            <slash:comments>3</slash:comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/404.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/12/24/SSMS-Execution-Plan-ndash-Insert-Index-Here.aspx</feedburner:origLink></item>
        <item>
            <title>Using Perforce Visual Merge with Team Foundation Server</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/rUeMhbmw6d8/Using-Perforce-Visual-Merge-with-Team-Foundation-Server.aspx</link>
            <description>&lt;p&gt;The best way to handle merging is to not do it at all :)  Merging can be a very painful process, especially if you are using the wrong tools.  I was a long time user of Perforce for source control and this company’s great tools made merging very straight forward.  I have now transitioned to a Team Foundation Server 2008 environment and while this tool is growing in usefulness, it still lacks in a few areas.  Luckily TFS can be configured to use existing merge tools, including &lt;a target="_blank" href="http://perforce.com/perforce/products/merge.html"&gt;Perforce Visual Merge&lt;/a&gt; (P4merge) from Perforce.&lt;/p&gt;  &lt;p&gt;You can configure TFS to use a different merge tool by running the following from a Visual Studio Command Prompt:&lt;/p&gt;  &lt;pre&gt;tf diff /configure&lt;/pre&gt;

&lt;p&gt;This brings up a dialog like so&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blechie.com/images/blechie_com/WPierce/WindowsLiveWriter/UsingPerforceVisualMergewithTeamFoundati_8950/image_3.png" width="480" height="286" /&gt; &lt;/p&gt;

&lt;p&gt;If you don’t already have a Merge operation line, you can add one, otherwise just modify the existing one and make it look like so:&lt;/p&gt;

&lt;p&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://blechie.com/images/blechie_com/WPierce/WindowsLiveWriter/UsingPerforceVisualMergewithTeamFoundati_8950/image_6.png" width="419" height="224" /&gt; &lt;/p&gt;

&lt;p&gt;If you are curious you can click the right-arrow to see what each command line argument represents.  You may be wondering why the command is for p4merge.&lt;strong&gt;&lt;em&gt;&lt;u&gt;bat&lt;/u&gt;&lt;/em&gt;&lt;/strong&gt; instead of the executable.  P4Merge expects the original file, branch 1 file, branch 2 file, and the final merged file to all exist for it to operate properly.  Unfortunately, TFS does not create the merged file before it invokes the merge tool.  To work around this I created a simple batch file that will create the merge file at the path provided (%4) then invoke p4merge.exe.  Simply paste the following into p4merge.bat and you are ready to rock.&lt;/p&gt;

&lt;pre&gt;@ECHO OFF
COPY /Y NUL "%4"
START /WAIT /D "C:\Program Files (x86)\Perforce" p4merge.exe "%1" "%2" "%3" "%4"&lt;/pre&gt;&lt;img src="http://blechie.com/WPierce/aggbug/403.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/W4onwtIEheXlrnd2I8ZcIVfpVKk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W4onwtIEheXlrnd2I8ZcIVfpVKk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/W4onwtIEheXlrnd2I8ZcIVfpVKk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/W4onwtIEheXlrnd2I8ZcIVfpVKk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=rUeMhbmw6d8:GZPhYz8Trd0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=rUeMhbmw6d8:GZPhYz8Trd0:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=rUeMhbmw6d8:GZPhYz8Trd0:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=rUeMhbmw6d8:GZPhYz8Trd0:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=rUeMhbmw6d8:GZPhYz8Trd0:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=rUeMhbmw6d8:GZPhYz8Trd0:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/rUeMhbmw6d8" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/12/24/Using-Perforce-Visual-Merge-with-Team-Foundation-Server.aspx</guid>
            <pubDate>Wed, 24 Dec 2008 17:45:54 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/403.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/12/24/Using-Perforce-Visual-Merge-with-Team-Foundation-Server.aspx#feedback</comments>
            <slash:comments>4</slash:comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/403.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/12/24/Using-Perforce-Visual-Merge-with-Team-Foundation-Server.aspx</feedburner:origLink></item>
        <item>
            <title>Blogs I Follow</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/a91HFi_PLtg/Blogs-I-Follow.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://www.codethinked.com/" target="_blank"&gt;Justin Etheredge&lt;/a&gt; posted a list of &lt;a href="http://www.codethinked.com/post/2008/10/07/Blogs-I-Follow-October-2008.aspx" target="_blank"&gt;blogs that he follows&lt;/a&gt;.  He also posted a snippet of LINQ that converted his OPML file to a simple unordered HTML list.  He encouraged his readership to let him know if there are any really good blogs he was missing.  I was curious to see which blogs he reads that I have not yet subscribed to.  I tweaked his LINQ slightly to output blogs that were in his &lt;a href="http://media.codethinked.com/downloads/Opml.xml" target="_blank"&gt;OPML&lt;/a&gt; file, but not in &lt;a href="http://services.newsgator.com/ngws/svc/opml.aspx?uid=134891&amp;amp;mid=1" target="_blank"&gt;mine&lt;/a&gt;.&lt;/p&gt;
&lt;pre class="c#" name="code"&gt;var doc1 = XDocument.Load("http://media.codethinked.com/downloads/Opml.xml");
var doc2 = XDocument.Load("http://services.newsgator.com/ngws/svc/opml.aspx?uid=134891&amp;amp;mid=1");

var result = new XElement("ul",
  from d1 in doc1.Elements("opml").Elements("body").Elements("outline")
  join d2 in doc2.Elements("opml").Elements("body").Elements("outline")
    on d1.Attribute("htmlUrl").Value equals d2.Attribute("htmlUrl").Value into d3
  from d2 in d3.DefaultIfEmpty()
  where d2 == null
  select 
    new XElement("li", 
      new XElement("a", 
        new XAttribute("href", d1.Attribute("htmlUrl").Value), d1.Attribute("text").Value
      ), 
      " ", 
      new XElement("a", 
        new XAttribute("href", d1.Attribute("xmlUrl").Value), "RSS"
      )
    )
  );

using (var xw = XmlWriter.Create("diff.xml", new XmlWriterSettings { Indent = true }))  
{   
  result.WriteTo(xw);
}&lt;/pre&gt;
&lt;p&gt;diff.xml will contain blogs present in doc1 but not present in doc2.  This is by no means perfect so don’t cry if it includes a few entries present in both or doesn’t work with your OPML.  You could easily see which blogs both Justin and I read by changing the where clause.&lt;/p&gt;
&lt;p&gt;Several readers wrote to Justin asking how he could possibly keep up with that many blogs.  I only spend about 20 minutes a day reading through new posts.  Only &lt;a href="http://ayende.com/blog/" target="_blank"&gt;autonomous coding machines&lt;/a&gt; post everyday, so as long as I don’t lapse for more than a day or two it isn’t a problem keeping up.  I also skim long posts and flag them for a more thorough reading later.  Most of my subscriptions focus on .Net development but I have a few outliers like &lt;a href="http://www.zedshaw.com/blog/index.html" target="_blank"&gt;Zed Shaw&lt;/a&gt;’s blog.  It can make for an extremely entertaining read (as long as you are not the subject of his attentions :).&lt;/p&gt;&lt;img src="http://blechie.com/WPierce/aggbug/396.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rnaBR8qv0y5GEoDeMyEOZ3OFnZA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rnaBR8qv0y5GEoDeMyEOZ3OFnZA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/rnaBR8qv0y5GEoDeMyEOZ3OFnZA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rnaBR8qv0y5GEoDeMyEOZ3OFnZA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=a91HFi_PLtg:8xgCP8xMKHA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=a91HFi_PLtg:8xgCP8xMKHA:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=a91HFi_PLtg:8xgCP8xMKHA:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=a91HFi_PLtg:8xgCP8xMKHA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=a91HFi_PLtg:8xgCP8xMKHA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=a91HFi_PLtg:8xgCP8xMKHA:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/a91HFi_PLtg" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/10/21/Blogs-I-Follow.aspx</guid>
            <pubDate>Tue, 21 Oct 2008 17:18:35 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/396.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/10/21/Blogs-I-Follow.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/396.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/10/21/Blogs-I-Follow.aspx</feedburner:origLink></item>
        <item>
            <title>NHibernate ProxyGenerators 1.0.0 Beta Released</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/kxqh1_eXhyI/NHibernate-ProxyGenerators-1.0.0-Beta-Released.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://www.nhforge.org/blogs/nhibernate/archive/2008/10/07/nhibernate-proxygenerators-1-0-0-beta-released.aspx"&gt;Read about it at&lt;/a&gt; &lt;a href="http://nhforge.org/" target="_blank"&gt;NHForge.org&lt;/a&gt;&lt;/p&gt;  &lt;div style="padding-right: 0px; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px; display: inline" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:78792738-1207-4a67-b579-4aef707a5072" class="wlWriterEditableSmartContent"&gt;del.icio.us Tags: &lt;a href="http://del.icio.us/popular/nhibernate+proxygenerators" rel="tag"&gt;nhibernate proxygenerators&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blechie.com/WPierce/aggbug/394.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/AwLFhIgWl8E84g2lM2l-_9ZJtgw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AwLFhIgWl8E84g2lM2l-_9ZJtgw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/AwLFhIgWl8E84g2lM2l-_9ZJtgw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/AwLFhIgWl8E84g2lM2l-_9ZJtgw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=kxqh1_eXhyI:0xK0EeyPpAY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=kxqh1_eXhyI:0xK0EeyPpAY:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=kxqh1_eXhyI:0xK0EeyPpAY:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=kxqh1_eXhyI:0xK0EeyPpAY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=kxqh1_eXhyI:0xK0EeyPpAY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=kxqh1_eXhyI:0xK0EeyPpAY:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/kxqh1_eXhyI" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/10/07/NHibernate-ProxyGenerators-1.0.0-Beta-Released.aspx</guid>
            <pubDate>Tue, 07 Oct 2008 20:48:00 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/394.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/10/07/NHibernate-ProxyGenerators-1.0.0-Beta-Released.aspx#feedback</comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/394.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/10/07/NHibernate-ProxyGenerators-1.0.0-Beta-Released.aspx</feedburner:origLink></item>
        <item>
            <title>Please Explain the Following</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/yYmo_UZnwUU/Please-Explain-the-Following.aspx</link>
            <description>&lt;p&gt;Can someone please explain how this is possible?&lt;a href="http://blechie.com/images/blechie_com/WPierce/WindowsLiveWriter/PleaseExplaintheFollowing_DB80/Stumped_2.png" rel="lightbox"&gt;&lt;img style="border-right: 0px; border-top: 0px; margin-left: 0px; border-left: 0px; margin-right: 0px; border-bottom: 0px; display: inline" title="Stumped" border="0" alt="Stumped" align="left" src="http://blechie.com/images/blechie_com/WPierce/WindowsLiveWriter/PleaseExplaintheFollowing_DB80/Stumped_thumb.png" width="1078" height="331" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://blechie.com/WPierce/aggbug/393.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HxgBBuoBJNv97t7gTeyz2dbpWHM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HxgBBuoBJNv97t7gTeyz2dbpWHM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/HxgBBuoBJNv97t7gTeyz2dbpWHM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HxgBBuoBJNv97t7gTeyz2dbpWHM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=yYmo_UZnwUU:9y4zmDeK6qg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=yYmo_UZnwUU:9y4zmDeK6qg:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=yYmo_UZnwUU:9y4zmDeK6qg:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=yYmo_UZnwUU:9y4zmDeK6qg:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=yYmo_UZnwUU:9y4zmDeK6qg:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=yYmo_UZnwUU:9y4zmDeK6qg:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/yYmo_UZnwUU" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/10/06/Please-Explain-the-Following.aspx</guid>
            <pubDate>Mon, 06 Oct 2008 21:36:38 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/393.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/10/06/Please-Explain-the-Following.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/393.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/10/06/Please-Explain-the-Following.aspx</feedburner:origLink></item>
        <item>
            <title>Introducing NHibernate ProxyGenerators</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/3zZ0JORU69o/Introducing-NHibernate-ProxyGenerators.aspx</link>
            <description>&lt;p&gt;&lt;a href="http://blechie.com/WPierce/archive/2008/02/17/Lazy-Loading-with-nHibernate-Under-Medium-Trust.aspx" target="_blank"&gt;NPG&lt;/a&gt; is dead.  Long live &lt;a href="http://www.nhforge.org/blogs/nhibernate/archive/2008/09/22/introducing-nhibernate-proxygenerators.aspx" target="_blank"&gt;NHPG&lt;/a&gt;.  In an attempt to not duplicate information, I’m going to put most of the technical details on &lt;a href="http://nhforge.org/" target="_blank"&gt;NHForge&lt;/a&gt;.  I will highlight here the improvements that have been made to NHPG since its original inception.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Renamed NPG.exe to NHPG.exe (Duh)&lt;/li&gt;    &lt;li&gt;Improved error handling and informative error messages&lt;/li&gt;    &lt;li&gt;You can now provide several mapping assemblies at once&lt;/li&gt;    &lt;li&gt;Removed dependency on &lt;a href="http://castleproject.org/activerecord/index.html" target="_blank"&gt;ActiveRecord&lt;/a&gt;.  Don’t cry though, you can still use it on AR assemblies.&lt;/li&gt;    &lt;li&gt;Now with more cowbell&lt;/li&gt;    &lt;li&gt;I was given the directive to support multiple proxy generation frameworks and while the design is there, you can currently get your proxies in any color, as long as it’s black.  (By color I mean framework and by black I mean &lt;a href="http://castleproject.org/dynamicproxy/index.html" target="_blank"&gt;DynamicProxy2&lt;/a&gt;)&lt;/li&gt;    &lt;li&gt;Improved unit test coverage.  (By improved I mean there was none and now there is some)&lt;/li&gt;    &lt;li&gt;Improved runtime logging (See previous bullet)&lt;/li&gt;    &lt;li&gt;The code now looks like a slightly more intelligent monkey wrote it&lt;/li&gt;    &lt;li&gt;Intermediate files are now cleaned up properly&lt;/li&gt;    &lt;li&gt;Proxy assembly version is now synchronized with mapping assembly version&lt;/li&gt;    &lt;li&gt;Working example now distributed with source&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Where you can help.&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Additional proxy generation implementations&lt;/li&gt;    &lt;li&gt;The generation is dog slow&lt;/li&gt;    &lt;li&gt;The need for intermediate files mentioned above could probably be avoided by someone who knows what they’re doing&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Enjoy, and please proxy responsibly.&lt;/p&gt;  &lt;div style="padding-right: 0px; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px; display: inline" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:1a456ac0-8a37-4b25-b3c9-64a2a7c73e0b" class="wlWriterEditableSmartContent"&gt;del.icio.us Tags: &lt;a href="http://del.icio.us/popular/NHibernate" rel="tag"&gt;NHibernate&lt;/a&gt;,&lt;a href="http://del.icio.us/popular/proxy+generator" rel="tag"&gt;proxy generator&lt;/a&gt;,&lt;a href="http://del.icio.us/popular/npg" rel="tag"&gt;npg&lt;/a&gt;,&lt;a href="http://del.icio.us/popular/nhpg" rel="tag"&gt;nhpg&lt;/a&gt;&lt;/div&gt;&lt;img src="http://blechie.com/WPierce/aggbug/392.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/1UIxHXtt26aelQk4CuoLYmwHppk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1UIxHXtt26aelQk4CuoLYmwHppk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/1UIxHXtt26aelQk4CuoLYmwHppk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/1UIxHXtt26aelQk4CuoLYmwHppk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=3zZ0JORU69o:DxsJ-UJ8IJM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=3zZ0JORU69o:DxsJ-UJ8IJM:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=3zZ0JORU69o:DxsJ-UJ8IJM:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=3zZ0JORU69o:DxsJ-UJ8IJM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=3zZ0JORU69o:DxsJ-UJ8IJM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=3zZ0JORU69o:DxsJ-UJ8IJM:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/3zZ0JORU69o" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/09/22/Introducing-NHibernate-ProxyGenerators.aspx</guid>
            <pubDate>Tue, 23 Sep 2008 05:06:12 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/392.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/09/22/Introducing-NHibernate-ProxyGenerators.aspx#feedback</comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/392.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/09/22/Introducing-NHibernate-ProxyGenerators.aspx</feedburner:origLink></item>
        <item>
            <title>Windows Live Writer on Server 2008</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/OVTNXcSmEEc/Windows-Live-Writer-on-Server-2008.aspx</link>
            <description>&lt;div class="wlWriterEditableSmartContent" id="scid:0767317B-992E-4b12-91E0-4F059A8CECA8:f7ef6734-9f61-4eca-8e5d-ec2d84b5c9ca" style="margin: 0px; padding: 0px; float: none; display: inline;"&gt;del.icio.us Tags: &lt;a rel="tag" href="http://del.icio.us/popular/live+writer+server+2008"&gt;live writer server 2008&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;This was way harder to find than it should have been.  There are various posts on downloading a &lt;a target="_blank" href="http://www.koushikdutta.com/2008/09/windows-live-writer-and-windows-server.html"&gt;Technical Preview that installs on Server 2008&lt;/a&gt;.  This installation told me it would expire shortly and it also appeared to be an older version (v12).  Some comment trolling turned up a German &lt;a target="_blank" href="http://www.live-writer.de/windows-live-writer-download/"&gt;Windows Live Writer Blog&lt;/a&gt; that had what I was looking for.  The link at the very bottom installed what appears to be the latest beta for Windows Server 2008 x64.&lt;/p&gt;
&lt;p&gt;&lt;img height="652" border="0" width="769" src="http://blechie.com/images/blechie_com/WPierce/WindowsLiveWriter/2ef6b032f17c_6A18/WLW-Server2008_3.jpg" alt="WLW-Server2008" title="WLW-Server2008" style="border-width: 0px; float: none; margin-left: auto; margin-right: auto; display: block;" /&gt;&lt;/p&gt;&lt;img src="http://blechie.com/WPierce/aggbug/391.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Ki5Gr9Guzd6FuBAKd9FHEIUtD9U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ki5Gr9Guzd6FuBAKd9FHEIUtD9U/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Ki5Gr9Guzd6FuBAKd9FHEIUtD9U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Ki5Gr9Guzd6FuBAKd9FHEIUtD9U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=OVTNXcSmEEc:PH1Hs9IX3_Q:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=OVTNXcSmEEc:PH1Hs9IX3_Q:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=OVTNXcSmEEc:PH1Hs9IX3_Q:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=OVTNXcSmEEc:PH1Hs9IX3_Q:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=OVTNXcSmEEc:PH1Hs9IX3_Q:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=OVTNXcSmEEc:PH1Hs9IX3_Q:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/OVTNXcSmEEc" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/09/22/Windows-Live-Writer-on-Server-2008.aspx</guid>
            <pubDate>Mon, 22 Sep 2008 13:46:00 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/391.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/09/22/Windows-Live-Writer-on-Server-2008.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/391.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/09/22/Windows-Live-Writer-on-Server-2008.aspx</feedburner:origLink></item>
        <item>
            <title>Poor Man's Shards in NHibernate</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/VfDDPqLTUIA/Poor-Mans-Shards-in-NHibernate.aspx</link>
            <description>&lt;p&gt;Another loosely coupled post on &lt;a href="http://blechie.com/WPierce/archive/2008/05/28/Going-to-Production-with-MonoRail.aspx" target="_blank"&gt;Going to Production with MonoRail&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;One thing I haven't stressed in recent posts is the absolute necessity to thoroughly test and understand the implications of your modifications when you start pushing a framework outside of the box.  In my post on &lt;a href="http://blechie.com/WPierce/archive/2008/06/06/Advanced-Dependency-Injection-with-Castle-Windsor.aspx" target="_blank"&gt;Advanced Dependency Injection with Castle Windsor&lt;/a&gt; I lightly touched on the lifestyle implications of my patch to the code.  The same warning covers today's post when we start jimmy jacking with a custom connection provider in &lt;a href="http://www.hibernate.org/343.html" target="_blank"&gt;NHibernate&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;If you've been following along you know that for various reasons we host multiple clients on a single instance of our B2B web application.  For other various reasons we like to keep the data for each client segregated into separate databases.  We use NHibernate for persistence ignorance so that seemed to be the logical place to start when attempting to segregate client data.  When I was doing my research it became apparent that at a high level I was trying to implement a &lt;a href="http://en.wikipedia.org/wiki/Partition_%28database%29" target="_blank"&gt;horizontally partitioned&lt;/a&gt; database.  In my case, partitioned by client.  &lt;a href="http://www.hibernate.org/" target="_blank"&gt;Hibernate&lt;/a&gt; supports horizontal database partitioning through &lt;a href="http://www.hibernate.org/414.html" target="_blank"&gt;Shards&lt;/a&gt;.  &lt;a href="http://darioquintana.com.ar/blogging/" target="_blank"&gt;Dario Quintana&lt;/a&gt; is in the process of porting Shards to NHibernate, but I don't believe it is quite ripe yet.  Shards appears to address all of the nuances and edge cases that would reveal themselves when attempting to logically split data.  My needs were much cruder and I was willing to sacrifice a fully functional implementation (see first paragraph above though).   &lt;/p&gt; &lt;p&gt;Each client hosted in our application has their own configuration file.  Within this file is a database connection string that points to the database for the particular client.  As long as the database structure of each database is identical, NHibernate is cool with that.  What I ended up implementing is a custom IConnectionProvider that would load the current client's configuration, read the connection string, and create a connection using that, rather than the connection string that would normally be read from your hibernate.cfg.xml file.  The sample code gets the job done.&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; My.Application
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; ClientConfigurationConnectionProvider : DriverConnectionProvider
  {
    &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;override&lt;/span&gt; IDbConnection GetConnection()
    {
      &lt;span class="kwrd"&gt;string&lt;/span&gt; clientId = ClientIdProvider.Get();

      &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;null&lt;/span&gt; == clientId)
      {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;base&lt;/span&gt;.GetConnection();
      }

      ClientConfiguration clientConfiguration = ClientConfigurationManager.GetByClientId(clientId);
      &lt;span class="kwrd"&gt;string&lt;/span&gt; dbConnectionString = clientConfiguration.DbConnectionString;
      &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(dbConnectionString))
      {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; &lt;span class="kwrd"&gt;base&lt;/span&gt;.GetConnection();
      }

      IDbConnection conn = Driver.CreateConnection();
      conn.ConnectionString = dbConnectionString;
      conn.Open();
      &lt;span class="kwrd"&gt;return&lt;/span&gt; conn;
    }
  }
}&lt;/pre&gt;
&lt;p&gt;Very straight forward.  By inheriting from the built in DriverConnectionProvider, most of the hard work is done for us.  To tell NHibernate to use our connection provider, a small change to the configuration file is required:&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;hibernate-configuration&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="urn:nhibernate-configuration-2.2"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;session-factory&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="rem"&gt;&amp;lt;!-- &amp;lt;property name="connection.provider"&amp;gt;NHibernate.Connection.DriverConnectionProvider&amp;lt;/property&amp;gt; --&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="connection.provider"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;strong&gt;&lt;u&gt;My.Application.ClientConfigurationConnectionProvider, My.Application&lt;/u&gt;&lt;/strong&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="dialect"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;NHibernate.Dialect.MsSql2000Dialect&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="connection.driver_class"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;NHibernate.Driver.SqlClientDriver&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="connection.connection_string"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Server=(local);Database=MyApplication;Trusted_Connection=True;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt; &lt;span class="attr"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;="show_sql"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;true&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;property&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;mapping&lt;/span&gt; &lt;span class="attr"&gt;assembly&lt;/span&gt;&lt;span class="kwrd"&gt;="My.Application"&lt;/span&gt; &lt;span class="kwrd"&gt;/&amp;gt;&lt;/span&gt;
  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;session-factory&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;hibernate-configuration&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;Remember what I said though, depending on your database structure, and the features of NHibernate you choose to take advantage of, bad and unexpected things could happen with this implementation, so do your testing.&lt;/p&gt;&lt;img src="http://blechie.com/WPierce/aggbug/378.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xQ8FG_1K3uo5smCQCBMP33CJGR0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xQ8FG_1K3uo5smCQCBMP33CJGR0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xQ8FG_1K3uo5smCQCBMP33CJGR0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xQ8FG_1K3uo5smCQCBMP33CJGR0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=VfDDPqLTUIA:0b_nBd_c-0U:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=VfDDPqLTUIA:0b_nBd_c-0U:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=VfDDPqLTUIA:0b_nBd_c-0U:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=VfDDPqLTUIA:0b_nBd_c-0U:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=VfDDPqLTUIA:0b_nBd_c-0U:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=VfDDPqLTUIA:0b_nBd_c-0U:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/VfDDPqLTUIA" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/06/08/Poor-Mans-Shards-in-NHibernate.aspx</guid>
            <pubDate>Sun, 08 Jun 2008 22:35:56 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/378.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/06/08/Poor-Mans-Shards-in-NHibernate.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/378.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/06/08/Poor-Mans-Shards-in-NHibernate.aspx</feedburner:origLink></item>
        <item>
            <title>Runtime Dynamic Actions in MonoRail with Windsor</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/oBUpLKC6lzA/Runtime-Dynamic-Actions-in-MonoRail-with-Windsor.aspx</link>
            <description>&lt;p&gt;Another loosely coupled post on &lt;a href="http://blechie.com/WPierce/archive/2008/05/28/Going-to-Production-with-MonoRail.aspx" target="_blank"&gt;Going to Production with MonoRail&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;The ability to customize every aspect of an application &lt;a target="_blank" href="http://www.lego.com/"&gt;Lego&lt;/a&gt; style is great, but there will always be client needs that are absolutely off the wall.  Not a customization of an existing component, but something so specific and unique to the client's domain that it cannot be encapsulated into something reusable.  My mind struggled with the paradox, how do I architect the ability to insert non-reusable functionality in a reusable way?  &lt;a target="_blank" href="http://devlicio.us/blogs/mike_nichols/default.aspx"&gt;Mike Nichols&lt;/a&gt; put me on the &lt;a target="_blank" href="http://groups.google.com/group/castle-project-devel/browse_thread/thread/8c7ada11050d1084/9486faf566f74063?#"&gt;path&lt;/a&gt; to my solution.&lt;/p&gt;
&lt;p&gt;&lt;a target="_blank" href="http://www.castleproject.org/monorail/documentation/trunk/advanced/dynactions.html"&gt;Dynamic Actions&lt;/a&gt; are a feature of MonoRail that allow you to decouple an action from a controller.  This sounds pretty simple but when you read through the documentation and the many ways that &lt;a target="_blank" href="http://hammett.castleproject.org/?p=73"&gt;developers&lt;/a&gt; are putting them into practice, Dynamic Actions reveal their true power.  The first part of my solution: completely custom functionality is simply implemented by a class that implements &lt;a target="_blank" href="http://api.castleproject.org/html/T_Castle_MonoRail_Framework_IDynamicAction.htm"&gt;IDynamicAction&lt;/a&gt;.  Each piece of custom functionality corresponds to a dynamic action.  The next question is how do I expose this functionality to the Client?  How do I ensure that this functionality is only exposed to the Client that paid for it?&lt;/p&gt;
&lt;p&gt;I haven't yet posted about how we manage configuration for each client, but essentially we have an INI file (cringe! gasp! moan!) for each client hosted on a particular server.  A sample section of the INI file for the Contoso client would look like so:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;[Actions]&lt;br /&gt;DoWork=ContosoDoWorkAction&lt;br /&gt;DoWork2=ContosoDoWork2Action&lt;/pre&gt;
&lt;p&gt;The key (DoWork) represents the name of the action, the value (ContosoDoWorkAction) is the name of a class that implements IDynamicAction and the logic for the custom functionality required by the client.  Actions are loaded into the &lt;a target="_blank" href="http://blechie.com/WPierce/archive/2008/06/06/Advanced-Dependency-Injection-with-Castle-Windsor.aspx"&gt;child container for the Client&lt;/a&gt; during application startup.  Now we need a controller that we can attach these actions to at runtime.  This is achieved using the code sample below:&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; My.Application&lt;br /&gt;{&lt;br /&gt;  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CustomController : Controller&lt;br /&gt;  {&lt;br /&gt;    &lt;span class="kwrd"&gt;public&lt;/span&gt; CustomController(IKernel kernel)&lt;br /&gt;    {&lt;br /&gt;      ClientConfiguration clientConfig = ClientConfigurationManager.GetCurrent();&lt;br /&gt;&lt;br /&gt;      NameValueCollection actions = clientConfig.Actions;&lt;br /&gt;&lt;br /&gt;      &lt;span class="kwrd"&gt;foreach&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt; actionName &lt;span class="kwrd"&gt;in&lt;/span&gt; actions.AllKeys)&lt;br /&gt;      {&lt;br /&gt;        &lt;span class="kwrd"&gt;string&lt;/span&gt; actionTypeName = actions[actionName];&lt;br /&gt;        Type actionType = Utility.GetImplType(actionTypeName);&lt;br /&gt;        DynamicActions[actionName] = (IDynamicAction)kernel.Resolve(actionType);&lt;br /&gt;      }&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;}&lt;/pre&gt;
&lt;p&gt;So simple it should be criminal.  With the configuration sample above and the CustomController implementation, we now have valid URLs of:&lt;/p&gt;
&lt;p&gt;https://contoso.myb2bapplication.com/custom/DoWork.rails&lt;/p&gt;
&lt;p&gt;https://contoso.myb2bapplication.com/custom/DoWork2.rails&lt;/p&gt;
&lt;p&gt;At the same time, by the nature of our &lt;a target="_blank" href="http://blechie.com/WPierce/archive/2008/06/06/Advanced-Dependency-Injection-with-Castle-Windsor.aspx"&gt;child container configuration magic&lt;/a&gt;, the following URLs would be invalid:&lt;/p&gt;
&lt;p&gt;https://fabrikam.myb2bapplication.com/custom/DoWork.rails&lt;/p&gt;
&lt;p&gt;https://fabrikam.myb2bapplication.com/custom/DoWork2.rails&lt;/p&gt;
&lt;p&gt;This is because the actions are only available to the client for which they were configured.  By the same token I can disable an action by commenting out the line in the configuration file.&lt;/p&gt;
&lt;p&gt;Who's your daddy paradox?&lt;/p&gt;&lt;img src="http://blechie.com/WPierce/aggbug/377.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/O3y7dmmI0GmJ_dw_TW8tQufMMOg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/O3y7dmmI0GmJ_dw_TW8tQufMMOg/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/O3y7dmmI0GmJ_dw_TW8tQufMMOg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/O3y7dmmI0GmJ_dw_TW8tQufMMOg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=oBUpLKC6lzA:Vb9Q7mqMdOQ:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=oBUpLKC6lzA:Vb9Q7mqMdOQ:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=oBUpLKC6lzA:Vb9Q7mqMdOQ:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=oBUpLKC6lzA:Vb9Q7mqMdOQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=oBUpLKC6lzA:Vb9Q7mqMdOQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=oBUpLKC6lzA:Vb9Q7mqMdOQ:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/oBUpLKC6lzA" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/06/07/Runtime-Dynamic-Actions-in-MonoRail-with-Windsor.aspx</guid>
            <pubDate>Sat, 07 Jun 2008 20:40:30 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/377.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/06/07/Runtime-Dynamic-Actions-in-MonoRail-with-Windsor.aspx#feedback</comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/377.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/06/07/Runtime-Dynamic-Actions-in-MonoRail-with-Windsor.aspx</feedburner:origLink></item>
        <item>
            <title>Advanced Dependency Injection with Castle Windsor</title>
            <link>http://feedproxy.google.com/~r/wcpierce/~3/aj3vKKI9DmM/Advanced-Dependency-Injection-with-Castle-Windsor.aspx</link>
            <description>&lt;p&gt;Another loosely coupled post on &lt;a href="http://blechie.com/WPierce/archive/2008/05/28/Going-to-Production-with-MonoRail.aspx" target="_blank"&gt;Going to Production with MonoRail&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;Many moons ago I wrote a post about &lt;a href="http://blechie.com/WPierce/archive/2006/09/30/Castle_MicroKernel__Whats_in_a_Name.aspx" target="_blank"&gt;dynamically resolving&lt;/a&gt; a component from the &lt;a href="http://castleproject.org/container/index.html" target="_blank"&gt;Castle container&lt;/a&gt; based on runtime parameters.  There was some discussion about the limitations of the approach (the biggest is that all components that require customization or components that have dependencies that require customization must be Transient) but overall it accomplished my goals at the time.  To summarize, my implementation allowed you to load multiple components that implement the same service (say an IOrderValidator) and also allowed you to provided a predicate that would be invoked when your code resolved an IOrderValidator to allow you to choose which specific implementation to return.  The idea was that you could have multiple clients hosted on a single instance of your application, each requiring their own order validation logic.  Using a runtime parameter (like the host header) your provided predicate would resolve the IOrderValidator associated with the particular client's requirements.  This implementation worked for some time but had a few limitations, namely all components for all clients had to be loaded into the same container.  This ended up being a tad unruly to manage.  There were also some limitations on the order in which components were loaded into the container, which was problematic when &lt;a href="http://hammett.castleproject.org/?p=286" target="_blank"&gt;auto configuring&lt;/a&gt; the container via code or something like &lt;a href="http://blechie.com/WPierce/archive/2007/06/19/Binsor_the_Friendly_DSL.aspx" target="_blank"&gt;Binsor&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;I set out for a better solution that addressed my new requirements and ran into the related issue of scoped containers that had been proposed on the Castle mailing lists.  Scoped containers have a slightly different use case and requirements but overlapped some with the approach I ultimately settled upon.  My container contains over thirty (30) components that make up the core functionality of the application.  Some of these components have dependencies on other components and all of this management, injection, and resolution is handled nicely and elegantly by the container.  Lets say for a particular client I need to customize one of the these components.  But the component in question has dependencies on three other components, whose functionality I do not need to customize.  I need a way to add my customized component to the container, but still resolve its dependencies from the core set of components.  The answer to my problem came in the form of Child Containers.&lt;/p&gt; &lt;p&gt;A child container is just like your standard container only that it has an associated parent.  When you try to resolve a component from a child container, it looks at its own components to fulfil dependencies and if it doesn't find it, it asks the parent container if it can fulfil the dependency.  This sounds like just the solution I needed.  I can load all of my core components into the parent container, then load any custom components into a child container.  One glaring flaw though.  Lets say I have component A that has a dependency on component B.  I have a core implementation of both components in my parent container.  I have a custom implementation of component B in my child container.  I attempt to resolve component A from the child container.  It is not present so it is retrieved from the parent container.  When resolving the dependency of component B, the parent uses the &lt;em&gt;&lt;u&gt;&lt;strong&gt;core&lt;/strong&gt;&lt;/u&gt;&lt;/em&gt; implementation, not the custom implementation in the child container.  I considered this a bug in the dependency resolution code and you can read about the ensuing discussion on the &lt;a href="http://groups.google.com/group/castle-project-devel/browse_thread/thread/81f987830d098791?hl=en" target="_blank"&gt;Castle mailing list&lt;/a&gt;.  This &lt;a href="http://forum.castleproject.org/viewtopic.php?p=12010&amp;amp;sid=d04cf9fa9f04694906dff4df75b1c9e9" target="_blank"&gt;issue was also&lt;/a&gt; reported by &lt;a href="http://rabdullin.com/" target="_blank"&gt;Rinat Adbullin&lt;/a&gt; a few months back and prompted him to choose another container implementation.  I submitted a &lt;a href="http://support.castleproject.org//browse/IOC-116" target="_blank"&gt;patch&lt;/a&gt; for my implementation but as far as I know it has not been applied.  I've heard &lt;a href="http://hammett.castleproject.org/" target="_blank"&gt;Hammett&lt;/a&gt; say that child containers are the devil (my words, not his) I believe because they can introduce difficult to diagnose bugs and make dependency resolution more complicated.  For my problem they have provided an elegant solution.&lt;/p&gt; &lt;p&gt;To bring this implementation into MonoRail was simply a matter of crafting a custom HttpApplication that implements &lt;a href="http://www.castleproject.org/container/documentation/trunk/manual/windsortypedocs/Generated_IContainerAccessor.html" target="_blank"&gt;IContainerAccessor&lt;/a&gt;, and returning the appropriate child container based on the host header of the current request.  I have the base container that contains all of the core components.  I create a child container with the base as its parent for each client and load the appropriate components.  MonoRail can be configured to use Windsor to resolve all of its internal components (including your controllers).  MonoRail calls IContainerAccessor.Container to obtain the container to use for its resolution.  By providing the appropriate child container to this call, I can ensure that any custom components for the particular client are used in place of the core components.  By using the dependency resolution patch discussed above, I ensure that any core component dependencies are properly resolved against any existing customized components in the child container (code sample below).&lt;/p&gt; &lt;p&gt;To sweeten the deal, child containers are configured using a simple text file that can be modified at runtime to turn individual custom components on or off on a per client basis, without restarting the application.  More on that in my future post on managing configuration.&lt;/p&gt;&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;namespace&lt;/span&gt; My.Application
{
  &lt;span class="kwrd"&gt;public&lt;/span&gt; &lt;span class="kwrd"&gt;class&lt;/span&gt; CustomHttpApplication : HttpApplication, IContainerAccessor
  {
    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; IWindsorContainer _baseContainer;

    &lt;span class="kwrd"&gt;private&lt;/span&gt; &lt;span class="kwrd"&gt;static&lt;/span&gt; &lt;span class="kwrd"&gt;readonly&lt;/span&gt; Hashtable _configToContainer = &lt;span class="kwrd"&gt;new&lt;/span&gt; Hashtable();

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; &lt;span class="kwrd"&gt;void&lt;/span&gt; Application_Start(&lt;span class="kwrd"&gt;object&lt;/span&gt; sender, EventArgs e)
    {
      _baseContainer = &lt;span class="kwrd"&gt;new&lt;/span&gt; CustomContainer();
    }

    &lt;span class="kwrd"&gt;public&lt;/span&gt; IWindsorContainer Container
    {
      get { &lt;span class="kwrd"&gt;return&lt;/span&gt; GetContainer(); }
    }

    &lt;span class="kwrd"&gt;protected&lt;/span&gt; &lt;span class="kwrd"&gt;virtual&lt;/span&gt; IWindsorContainer GetContainer()
    {
      &lt;span class="kwrd"&gt;string&lt;/span&gt; clientId = ClientIdProvider.Get();

      &lt;span class="kwrd"&gt;if&lt;/span&gt; (&lt;span class="kwrd"&gt;string&lt;/span&gt;.IsNullOrEmpty(clientId))
      {
        &lt;span class="kwrd"&gt;return&lt;/span&gt; _baseContainer;
      }

      ClientConfiguration clientConfig = ClientConfigurationManager.GetByClientId(clientId);

      IWindsorContainer clientContainer = &lt;span class="kwrd"&gt;null&lt;/span&gt;;

      &lt;span class="kwrd"&gt;if&lt;/span&gt; (!_configToContainer.ContainsKey(clientConfig.Path))
      {
        clientContainer = &lt;span class="kwrd"&gt;new&lt;/span&gt; CustomContainer(clientConfig, clientId, _baseContainer);
        _configToContainer.Add(clientConfig.Path, clientContainer);
      }
      &lt;span class="kwrd"&gt;else&lt;/span&gt;
      {
        clientContainer = (IWindsorContainer)_configToContainer[clientConfig.Path];
      }

      &lt;span class="kwrd"&gt;return&lt;/span&gt; clientContainer;
    }
  }
}&lt;/pre&gt;&lt;img src="http://blechie.com/WPierce/aggbug/376.aspx" width="1" height="1" /&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ctsRBR4YsLkyWCiNhf9QhItcLRQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ctsRBR4YsLkyWCiNhf9QhItcLRQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/ctsRBR4YsLkyWCiNhf9QhItcLRQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ctsRBR4YsLkyWCiNhf9QhItcLRQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=aj3vKKI9DmM:ONnSLX9BQhI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=aj3vKKI9DmM:ONnSLX9BQhI:dnMXMwOfBR0"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=dnMXMwOfBR0" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=aj3vKKI9DmM:ONnSLX9BQhI:7Q72WNTAKBA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=7Q72WNTAKBA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=aj3vKKI9DmM:ONnSLX9BQhI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?i=aj3vKKI9DmM:ONnSLX9BQhI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/wcpierce?a=aj3vKKI9DmM:ONnSLX9BQhI:63t7Ie-LG7Y"&gt;&lt;img src="http://feeds.feedburner.com/~ff/wcpierce?d=63t7Ie-LG7Y" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/wcpierce/~4/aj3vKKI9DmM" height="1" width="1"/&gt;</description>
            <dc:creator>Bill Pierce</dc:creator>
            <guid isPermaLink="false">http://blechie.com/WPierce/archive/2008/06/06/Advanced-Dependency-Injection-with-Castle-Windsor.aspx</guid>
            <pubDate>Fri, 06 Jun 2008 20:15:56 GMT</pubDate>
            <wfw:comment>http://blechie.com/WPierce/comments/376.aspx</wfw:comment>
            <comments>http://blechie.com/WPierce/archive/2008/06/06/Advanced-Dependency-Injection-with-Castle-Windsor.aspx#feedback</comments>
            <wfw:commentRss>http://blechie.com/WPierce/comments/commentRss/376.aspx</wfw:commentRss>
        <feedburner:origLink>http://blechie.com/WPierce/archive/2008/06/06/Advanced-Dependency-Injection-with-Castle-Windsor.aspx</feedburner:origLink></item>
    </channel>
</rss>
