<?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:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:georss="http://www.georss.org/georss" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>phazed.com</title><link>http://phazed.com/</link><description>Random technological babblings</description><generator>Graffiti CMS 1.2 (build 1.2.0.1451)</generator><lastBuildDate>Wed, 25 Nov 2009 22:34:00 GMT</lastBuildDate><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/Phazed" type="application/rss+xml" /><feedburner:emailServiceId>Phazed</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>BizTalk WCF Adapter Stack</title><link>http://feedproxy.google.com/~r/Phazed/~3/SlWWX4CCx94/</link><pubDate>Wed, 25 Nov 2009 22:34:00 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/biztalk-wcf-adapter-stack/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>0</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;For a while now I’ve been thinking about writing a post that documents all the gritty details of how the BizTalk messaging engine hooks into the WCF stack in the various WCF adapters. Now I don’t have to as &lt;a title="Paolo Salvatori" href="http://blogs.msdn.com/paolos/default.aspx"&gt;Paolo Salvatori&lt;/a&gt; has done a stunning job:&lt;/p&gt;  &lt;p&gt;&lt;a title="http://blogs.msdn.com/paolos/archive/2009/11/17/customizing-and-extending-the-biztalk-wcf-adapters.aspx" href="http://blogs.msdn.com/paolos/archive/2009/11/17/customizing-and-extending-the-biztalk-wcf-adapters.aspx"&gt;http://blogs.msdn.com/paolos/archive/2009/11/17/customizing-and-extending-the-biztalk-wcf-adapters.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Well done mate. This is by far the best explanation of how the BizTalk WCF adapter stack actually works. It should be in the documentation!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FwRPorV3ph7dFFb05uX0awxJCDs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FwRPorV3ph7dFFb05uX0awxJCDs/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/FwRPorV3ph7dFFb05uX0awxJCDs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FwRPorV3ph7dFFb05uX0awxJCDs/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/Phazed?a=SlWWX4CCx94:99ZfcABpr3c:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=SlWWX4CCx94:99ZfcABpr3c:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=SlWWX4CCx94:99ZfcABpr3c:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=SlWWX4CCx94:99ZfcABpr3c:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=SlWWX4CCx94:99ZfcABpr3c:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=SlWWX4CCx94:99ZfcABpr3c:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=SlWWX4CCx94:99ZfcABpr3c:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=SlWWX4CCx94:99ZfcABpr3c:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/SlWWX4CCx94" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/biztalk-wcf-adapter-stack/</feedburner:origLink></item><item><title>Visual Studio Theme Generator</title><link>http://feedproxy.google.com/~r/Phazed/~3/q2sicLjG5is/</link><pubDate>Tue, 17 Nov 2009 10:50:54 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/visual-studio-theme-generator/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>0</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;I’ve just discovered this and it’s awesome. If you like tweaking your Visual Studio theme, but can’t be bothered with going through the huge number of different settings that Visual Studio presents you with, then this makes it miles easier:&lt;/p&gt;  &lt;p&gt;&lt;a title="Visual Studio Theme Generator" href="http://frickinsweet.com/tools/Theme.mvc.aspx"&gt;http://frickinsweet.com/tools/Theme.mvc.aspx&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a title="Visual Studio Theme Generator" href="http://frickinsweet.com/tools/Theme.mvc.aspx"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="Visual Studio Theme Generator" border="0" alt="Visual Studio Theme Generator" src="http://phazed.com/files/media/image/WindowsLiveWriter/VisualStudioThemeGenerator_9882/image_3.png" width="524" height="259" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Select a background, foreground and main colour, tweak the contrast, hit refresh to preview your selections, and then when you’re finished, click create to generate a vssettings file you can import directly into Visual Studio.&lt;/p&gt; As the site says, frinkin’ sweet!
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/EJY4CsLiCLMUtvZ7rgTsgUpWvpw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/EJY4CsLiCLMUtvZ7rgTsgUpWvpw/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/EJY4CsLiCLMUtvZ7rgTsgUpWvpw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/EJY4CsLiCLMUtvZ7rgTsgUpWvpw/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/Phazed?a=q2sicLjG5is:i-V-D62PviY:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=q2sicLjG5is:i-V-D62PviY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=q2sicLjG5is:i-V-D62PviY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=q2sicLjG5is:i-V-D62PviY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=q2sicLjG5is:i-V-D62PviY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=q2sicLjG5is:i-V-D62PviY:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=q2sicLjG5is:i-V-D62PviY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=q2sicLjG5is:i-V-D62PviY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/q2sicLjG5is" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/visual-studio-theme-generator/</feedburner:origLink></item><item><title>Check your INI file encoding</title><link>http://feedproxy.google.com/~r/Phazed/~3/ILPI2mtZqss/</link><pubDate>Mon, 15 Jun 2009 10:26:57 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/check-your-ini-file-encoding/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>0</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;Last week I was assisting a customer with a production problem that appeared to be caused by the CLR JIT compiler &lt;a href="http://en.wikipedia.org/wiki/Inlining"&gt;inlining&lt;/a&gt; certain properties and methods. One of the quick workarounds we tried was to temporarily turn off JIT optimizations to see if it was indeed the inlining causing the problem. We did this using the &lt;a href="http://msdn.microsoft.com/en-us/library/9dd8z24x.aspx"&gt;.NET Framework Debugging Control INI file&lt;/a&gt;.&lt;/p&gt;   &lt;p&gt;I got out Visual Studio, created a new text file, called it the same name as our EXE, but with an INI extension, and added the following to the file:&lt;/p&gt;  &lt;pre class="code"&gt;[.NET Framework Debugging Control]
GenerateTrackingInfo=1
AllowOptimize=0&lt;/pre&gt;

&lt;p&gt;Then I saved the file and copied it to the same directory as our EXE, and restarted the application.&lt;/p&gt;

&lt;p&gt;The strange thing was that it had no effect whatsoever! Still our problem was there, and we were convinced by this point that it was the JIT inlining. I even went to the lengths of putting together a quick sample application that reproduced our problem and still this INI file wasn’t working.&lt;/p&gt;

&lt;p&gt;After over an hour banging our heads on our collective desks I started getting paranoid about the precise text in the INI file, and that’s when it dawned on me. The default encoding of text files in Visual Studio is UTF-8 with a signature. A quick check of the advanced save options confirmed this:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/CheckyourINIfileencoding_9C55/image3.png"&gt;&lt;img style="display: inline" title="Advanced Save Options" alt="Advanced Save Options" src="http://phazed.com/files/media/image/WindowsLiveWriter/CheckyourINIfileencoding_9C55/image3_thumb.png" width="473" height="241" /&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Flipping this over to Windows codepage 1252 and resaving the file solved the problem. No more JIT optimizations and our problem disappears, finally confirming our suspicions.&lt;/p&gt;

&lt;p&gt;So it would seem that &lt;a href="http://msdn.microsoft.com/en-us/library/ms724353%28VS.85%29.aspx"&gt;GetPrivateProfileString&lt;/a&gt; doesn’t like Unicode &lt;a href="http://en.wikipedia.org/wiki/Byte-order_mark"&gt;byte order mark&lt;/a&gt; signatures!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/uagYcujP4K137JdUQQeTvXU8HkA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uagYcujP4K137JdUQQeTvXU8HkA/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/uagYcujP4K137JdUQQeTvXU8HkA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/uagYcujP4K137JdUQQeTvXU8HkA/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/Phazed?a=ILPI2mtZqss:CwqhAwYcdew:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=ILPI2mtZqss:CwqhAwYcdew:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=ILPI2mtZqss:CwqhAwYcdew:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=ILPI2mtZqss:CwqhAwYcdew:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=ILPI2mtZqss:CwqhAwYcdew:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=ILPI2mtZqss:CwqhAwYcdew:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=ILPI2mtZqss:CwqhAwYcdew:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=ILPI2mtZqss:CwqhAwYcdew:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/ILPI2mtZqss" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/check-your-ini-file-encoding/</feedburner:origLink></item><item><title>Unity and the Factory Method Pattern</title><link>http://feedproxy.google.com/~r/Phazed/~3/ylT8YdUpogk/</link><pubDate>Thu, 23 Apr 2009 20:13:34 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/unity-and-the-factory-method-pattern/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>2</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;I’ve been playing around with &lt;a title="Unity" href="http://unity.codeplex.com/"&gt;Unity&lt;/a&gt; recently, and in particular I’ve been trying to get Unity to resolve dependencies from factory methods, and more specifically manage the lifetime of those dependencies. If you’re not familiar with the factory method pattern then check out &lt;a title="Wikipedia - Factory method pattern" href="http://en.wikipedia.org/wiki/Factory_method_pattern"&gt;Wikipedia&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;Out of the box, Unity does support the ability to register a type that is created by a factory method using the StaticFactoryExtension class. This extension allows you to specify a delegate that creates the type, and that delegate can then call a static factory method, or even resolve another type from the container and call it’s factory method. I’m not going to cover the specifics of how to use the StaticFactoryExtension here, but pop on over to &lt;a title="David Hayden&amp;#39;s Blog" href="http://www.davidhayden.com/blog.aspx"&gt;David Hayden&lt;/a&gt;’s blog for an &lt;a title="Unity StaticFactoryExtension - Registering FactoryDelegate to Create Object" href="http://davidhayden.com/blog/dave/archive/2009/02/08/UnityStaticFactoryExtensionRegisteringFactoryDelegateCreateObject.aspx"&gt;example&lt;/a&gt;.&lt;/p&gt;   &lt;p&gt;However, there’s a big drawback with the StaticFactoryExtension. It doesn’t allow you to specify any LifetimeManager, nor any InjectionMembers. This means that every time the factory method type is needed by a dependency, the factory method delegate is called. So you’re either forced to make your factory method manage object lifetimes, which isn’t nice, or put up with always having a new instance for every dependency. The lack of InjectionMembers also means that the factory method has to provide precisely the correctly configured object. This isn’t much of an issue for most factory methods, but it does provide more flexibility.&lt;/p&gt;  &lt;p&gt;So, what’s the solution? Well, I was pretty sure that it was going to require me to write some kind of Unity extension, and whilst I’m comfortable with using Unity, I’d not tried writing an extension before, other than a LifetimeManager. Unfortunately for me this requires you to know a bit about how ObjectBuilder works, and that’s not a particularly well documented bit of Unity. So, armed with the Unity source I started digging. What follows is the result.&lt;/p&gt;  &lt;p&gt;One of the first things I realized is that all I really need to do is modify the way that Unity builds objects at the stage where a specific constructor is called, and instead call a delegate to get the object instance. Everything else should stay the same. After a bit of digging I came across the UnityDefaultStrategiesExtension class, and in it’s Initialize method are the lines:&lt;/p&gt;  &lt;pre class="code"&gt;Context.BuildPlanStrategies.AddNew&amp;lt;&lt;span style="color: #2b91af"&gt;DynamicMethodConstructorStrategy&lt;/span&gt;&amp;gt;(
    &lt;span style="color: #2b91af"&gt;UnityBuildStage&lt;/span&gt;.Creation);
Context.BuildPlanStrategies.AddNew&amp;lt;&lt;span style="color: #2b91af"&gt;DynamicMethodPropertySetterStrategy&lt;/span&gt;&amp;gt;(
    &lt;span style="color: #2b91af"&gt;UnityBuildStage&lt;/span&gt;.Initialization);
Context.BuildPlanStrategies.AddNew&amp;lt;&lt;span style="color: #2b91af"&gt;DynamicMethodCallStrategy&lt;/span&gt;&amp;gt;(
    &lt;span style="color: #2b91af"&gt;UnityBuildStage&lt;/span&gt;.Initialization);&lt;/pre&gt;

&lt;p&gt;The bit that caught my eye was the DynamicMethodConstructorStrategy class. Looking in more detail at this class confirmed that it was responsible for generating part of a dynamic method that would actually call a constructor. This was the class I had to intercept and modify its behaviour. With this knowledge I started building my new extension, using the StaticFactoryExtension as an example.&lt;/p&gt;

&lt;p&gt;First I defined how I wanted to configure the extension in an interface. This interface has the same method signatures that you see on IUnityContainer for the generic versions of RegisterType, just naming them RegisterFactory and excluding the ones that take a TTo type parameter. You could quite easily add the non-generic versions too, but I didn’t bother.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public delegate object &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodDelegate&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;IUnityContainer &lt;/span&gt;container);

&lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IUnityContainerExtensionConfigurator
&lt;/span&gt;{
    &lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodDelegate &lt;/span&gt;factoryMethodDelegate,
                                                   &lt;span style="color: blue"&gt;params &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InjectionMember&lt;/span&gt;[] injectionMembers);

    &lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodDelegate &lt;/span&gt;factoryMethodDelegate,
                                                   &lt;span style="color: blue"&gt;string &lt;/span&gt;name,
                                                   &lt;span style="color: blue"&gt;params &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InjectionMember&lt;/span&gt;[] injectionMembers);

    &lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodDelegate &lt;/span&gt;factoryMethodDelegate,
                                                   &lt;span style="color: #2b91af"&gt;LifetimeManager &lt;/span&gt;lifetimeManager,
                                                   &lt;span style="color: blue"&gt;params &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InjectionMember&lt;/span&gt;[] injectionMembers);

    &lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodDelegate &lt;/span&gt;factoryMethodDelegate,
                                                   &lt;span style="color: blue"&gt;string &lt;/span&gt;name,
                                                   &lt;span style="color: #2b91af"&gt;LifetimeManager &lt;/span&gt;lifetimeManager,
                                                   &lt;span style="color: blue"&gt;params &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InjectionMember&lt;/span&gt;[] injectionMembers);
}&lt;/pre&gt;

&lt;p&gt;Next, I defined the extension class by deriving from UnityContainerExtension and implementing the configuration interface.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodExtension &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;UnityContainerExtension&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodDelegate &lt;/span&gt;factoryMethodDelegate,
                                                          &lt;span style="color: blue"&gt;params &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InjectionMember&lt;/span&gt;[] injectionMembers)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(factoryMethodDelegate, &lt;span style="color: blue"&gt;null&lt;/span&gt;, &lt;span style="color: blue"&gt;null&lt;/span&gt;, injectionMembers);
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodDelegate &lt;/span&gt;factoryMethodDelegate,
                                                          &lt;span style="color: blue"&gt;string &lt;/span&gt;name,
                                                          &lt;span style="color: blue"&gt;params &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InjectionMember&lt;/span&gt;[] injectionMembers)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(factoryMethodDelegate, name, &lt;span style="color: blue"&gt;null&lt;/span&gt;, injectionMembers);
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodDelegate &lt;/span&gt;factoryMethodDelegate,
                                                          &lt;span style="color: #2b91af"&gt;LifetimeManager &lt;/span&gt;lifetimeManager,
                                                          &lt;span style="color: blue"&gt;params &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InjectionMember&lt;/span&gt;[] injectionMembers)
    {
        &lt;span style="color: blue"&gt;return &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(factoryMethodDelegate, &lt;span style="color: blue"&gt;null&lt;/span&gt;, lifetimeManager, injectionMembers);
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration &lt;/span&gt;RegisterFactory&amp;lt;T&amp;gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodDelegate &lt;/span&gt;factoryMethodDelegate,
                                                          &lt;span style="color: blue"&gt;string &lt;/span&gt;name,
                                                          &lt;span style="color: #2b91af"&gt;LifetimeManager &lt;/span&gt;lifetimeManager,
                                                          &lt;span style="color: blue"&gt;params &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InjectionMember&lt;/span&gt;[] injectionMembers)
    {
        Container.RegisterType&amp;lt;T&amp;gt;(name, lifetimeManager, injectionMembers);
        Context.Policies.Set&amp;lt;&lt;span style="color: #2b91af"&gt;IFactoryMethodPolicy&lt;/span&gt;&amp;gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodPolicy&lt;/span&gt;(() =&amp;gt; factoryMethodDelegate(Container)),
                                                   &lt;span style="color: #2b91af"&gt;NamedTypeBuildKey&lt;/span&gt;.Make&amp;lt;T&amp;gt;(name));
        &lt;span style="color: blue"&gt;return this&lt;/span&gt;;
    }

    &lt;span style="color: blue"&gt;protected override void &lt;/span&gt;Initialize()
    {
        Context.BuildPlanStrategies.Clear();
        Context.BuildPlanStrategies.AddNew&amp;lt;&lt;span style="color: #2b91af"&gt;FactoryMethodConstructorStrategy&lt;/span&gt;&amp;gt;(&lt;span style="color: #2b91af"&gt;UnityBuildStage&lt;/span&gt;.Creation);
        Context.BuildPlanStrategies.AddNew&amp;lt;&lt;span style="color: #2b91af"&gt;DynamicMethodPropertySetterStrategy&lt;/span&gt;&amp;gt;(&lt;span style="color: #2b91af"&gt;UnityBuildStage&lt;/span&gt;.Initialization);
        Context.BuildPlanStrategies.AddNew&amp;lt;&lt;span style="color: #2b91af"&gt;DynamicMethodCallStrategy&lt;/span&gt;&amp;gt;(&lt;span style="color: #2b91af"&gt;UnityBuildStage&lt;/span&gt;.Initialization);
    }
}&lt;/pre&gt;

&lt;p&gt;The two important pieces here are the Initialize method and the last RegisterFactory method. In Initialize I’m getting rid of the default BuildPlanStrategies and replacing them for my own. Actually, the only difference between these and the defaults defined in UnityDefaultStrategiesExtension is the FactoryMethodConstructorStrategy used in the creation stage, but I’ll come to that later.&lt;/p&gt;

&lt;p&gt;In the last RegisterFactory method I register the from type as normal with the container, passing the LifetimeManager and InjectionMembers, but I also set an additional policy, IFactoryMethodPolicy, on the context. This wraps up the factory method delegate with the container into a more simple delegate that just returns an object, and is keyed using the same key that identifies the from type. This policy is used later when I need to call the factory delegate as part of building up the object. The FactoryMethodPolicy class is quite simple and just wraps the simplified delegate.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public delegate object &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodPolicyDelegate&lt;/span&gt;();

&lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IFactoryMethodPolicy &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IBuilderPolicy
&lt;/span&gt;{
    &lt;span style="color: #2b91af"&gt;FactoryMethodPolicyDelegate &lt;/span&gt;FactoryMethodPolicyDelegate { &lt;span style="color: blue"&gt;get&lt;/span&gt;; }
}

&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodPolicy &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IFactoryMethodPolicy
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;private readonly &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodPolicyDelegate &lt;/span&gt;factoryMethodPolicyDelegate;

    &lt;span style="color: blue"&gt;public &lt;/span&gt;FactoryMethodPolicy(&lt;span style="color: #2b91af"&gt;FactoryMethodPolicyDelegate &lt;/span&gt;factoryMethodPolicyDelegate)
    {
        &lt;span style="color: blue"&gt;this&lt;/span&gt;.factoryMethodPolicyDelegate = factoryMethodPolicyDelegate;
    }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodPolicyDelegate &lt;/span&gt;FactoryMethodPolicyDelegate
    {
        &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;factoryMethodPolicyDelegate; }
    }
}&lt;/pre&gt;

&lt;p&gt;The final link in the chain is the FactoryMethodConstructorStrategy class.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodConstructorStrategy &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;DynamicMethodConstructorStrategy
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;private static readonly &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MethodInfo &lt;/span&gt;FactoryMethodPolicyDelegateInvoke =
        &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodPolicyDelegate&lt;/span&gt;).GetMethod(&lt;span style="color: #a31515"&gt;&amp;quot;Invoke&amp;quot;&lt;/span&gt;);

    &lt;span style="color: blue"&gt;private static readonly &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MethodInfo &lt;/span&gt;GetFactoryMethodPolicyDelegateMethodInfo =
        &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;FactoryMethodConstructorStrategy&lt;/span&gt;).GetMethod(&lt;span style="color: #a31515"&gt;&amp;quot;GetFactoryMethodPolicyDelegate&amp;quot;&lt;/span&gt;);

    &lt;span style="color: blue"&gt;public override void &lt;/span&gt;PreBuildUp(&lt;span style="color: #2b91af"&gt;IBuilderContext &lt;/span&gt;context)
    {
        &lt;span style="color: #2b91af"&gt;Guard&lt;/span&gt;.ArgumentNotNull(context, &lt;span style="color: #a31515"&gt;&amp;quot;context&amp;quot;&lt;/span&gt;);
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(GetFactoryMethodPolicyDelegate(context) == &lt;span style="color: blue"&gt;null&lt;/span&gt;)
        {
            &lt;span style="color: blue"&gt;base&lt;/span&gt;.PreBuildUp(context);
            &lt;span style="color: blue"&gt;return&lt;/span&gt;;
        }
        &lt;span style="color: blue"&gt;var &lt;/span&gt;buildContext = (&lt;span style="color: #2b91af"&gt;DynamicBuildPlanGenerationContext&lt;/span&gt;)context.Existing;
        &lt;span style="color: #2b91af"&gt;Label &lt;/span&gt;existingObjectNotNull = buildContext.IL.DefineLabel();
        buildContext.EmitLoadExisting();
        buildContext.IL.Emit(&lt;span style="color: #2b91af"&gt;OpCodes&lt;/span&gt;.Brtrue, existingObjectNotNull);
        buildContext.EmitLoadContext();
        buildContext.IL.EmitCall(&lt;span style="color: #2b91af"&gt;OpCodes&lt;/span&gt;.Call, GetFactoryMethodPolicyDelegateMethodInfo, &lt;span style="color: blue"&gt;null&lt;/span&gt;);
        buildContext.IL.EmitCall(&lt;span style="color: #2b91af"&gt;OpCodes&lt;/span&gt;.Callvirt, FactoryMethodPolicyDelegateInvoke, &lt;span style="color: blue"&gt;null&lt;/span&gt;);
        buildContext.EmitStoreExisting();
        buildContext.IL.MarkLabel(existingObjectNotNull);
    }

    &lt;span style="color: blue"&gt;public static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodPolicyDelegate &lt;/span&gt;GetFactoryMethodPolicyDelegate(&lt;span style="color: #2b91af"&gt;IBuilderContext &lt;/span&gt;context)
    {
        &lt;span style="color: blue"&gt;var &lt;/span&gt;factoryMethodPolicy = context.Policies.Get&amp;lt;&lt;span style="color: #2b91af"&gt;IFactoryMethodPolicy&lt;/span&gt;&amp;gt;(context.BuildKey);
        &lt;span style="color: blue"&gt;return &lt;/span&gt;factoryMethodPolicy == &lt;span style="color: blue"&gt;null &lt;/span&gt;? &lt;span style="color: blue"&gt;null &lt;/span&gt;: factoryMethodPolicy.FactoryMethodPolicyDelegate;
    }
}&lt;/pre&gt;
This class derives from the original DynamicMethodConstructorStrategy class whose behaviour I want to modify. I override the PreBuildUp method and check to see if there is an IFactoryMethodPolicy with a delegate defined for the build key in the context. If there isn’t I simply call the base implementation of PreBuildUp that will generate the dynamic method bits to call a constructor. However, if there is a delegate defined then I generate the dynamic method bits that call this delegate. 

&lt;p&gt;And once it’s all put together, that’s it! For good measure I’ve included the tests I used below. I’m certainly finding this useful in my projects, and if you do too I’d really like to hear about your experiences. Please feel free to comment on this post, even if it’s a bug you find!&lt;/p&gt;

&lt;pre class="code"&gt; [&lt;span style="color: #2b91af"&gt;TestFixture&lt;/span&gt;]
 &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FactoryMethodExtensionTests
 &lt;/span&gt;{
     &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestStringFactory
     &lt;/span&gt;{
         &lt;span style="color: blue"&gt;private readonly string &lt;/span&gt;factory;

         &lt;span style="color: blue"&gt;public &lt;/span&gt;TestStringFactory(&lt;span style="color: blue"&gt;string &lt;/span&gt;factory)
         {
             &lt;span style="color: blue"&gt;this&lt;/span&gt;.factory = factory;
         }

         &lt;span style="color: blue"&gt;public string &lt;/span&gt;GetString()
         {
             &lt;span style="color: blue"&gt;return &lt;/span&gt;factory;
         }
     }

     &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestStringDependency
     &lt;/span&gt;{
         &lt;span style="color: blue"&gt;private readonly string &lt;/span&gt;dependency;

         &lt;span style="color: blue"&gt;public &lt;/span&gt;TestStringDependency(&lt;span style="color: blue"&gt;string &lt;/span&gt;dependency)
         {
             &lt;span style="color: blue"&gt;this&lt;/span&gt;.dependency = dependency;
         }

         &lt;span style="color: blue"&gt;public string &lt;/span&gt;Dependency
         {
             &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;dependency; }
         }
     }

     [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
     &lt;span style="color: blue"&gt;public void &lt;/span&gt;FactoryMethodCanBeUsedToResolveTypeDependency()
     {
         &lt;span style="color: blue"&gt;var &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityContainer&lt;/span&gt;();
         container.AddNewExtension&amp;lt;&lt;span style="color: #2b91af"&gt;FactoryMethodExtension&lt;/span&gt;&amp;gt;();
         container.Configure&amp;lt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration&lt;/span&gt;&amp;gt;()
             .RegisterFactory&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(c =&amp;gt; &lt;span style="color: #a31515"&gt;&amp;quot;FactoryString&amp;quot;&lt;/span&gt;);
         container.RegisterType&amp;lt;&lt;span style="color: #2b91af"&gt;TestStringDependency&lt;/span&gt;&amp;gt;();

         &lt;span style="color: blue"&gt;var &lt;/span&gt;resolve = container.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;TestStringDependency&lt;/span&gt;&amp;gt;();

         &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: #a31515"&gt;&amp;quot;FactoryString&amp;quot;&lt;/span&gt;, resolve.Dependency);
     }

     [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
     &lt;span style="color: blue"&gt;public void &lt;/span&gt;FactoryMethodCanUseContainerToResolveTypeToGetFactoryMethodUsedInDependency()
     {
         &lt;span style="color: blue"&gt;var &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityContainer&lt;/span&gt;();
         container.AddNewExtension&amp;lt;&lt;span style="color: #2b91af"&gt;FactoryMethodExtension&lt;/span&gt;&amp;gt;();
         container.RegisterInstance(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TestStringFactory&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;FactoryString&amp;quot;&lt;/span&gt;));
         container.Configure&amp;lt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration&lt;/span&gt;&amp;gt;()
             .RegisterFactory&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;(c =&amp;gt; c.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;TestStringFactory&lt;/span&gt;&amp;gt;().GetString());
         container.RegisterType&amp;lt;&lt;span style="color: #2b91af"&gt;TestStringDependency&lt;/span&gt;&amp;gt;();

         &lt;span style="color: blue"&gt;var &lt;/span&gt;resolve = container.Resolve&amp;lt;&lt;span style="color: #2b91af"&gt;TestStringDependency&lt;/span&gt;&amp;gt;();

         &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="color: #a31515"&gt;&amp;quot;FactoryString&amp;quot;&lt;/span&gt;, resolve.Dependency);
     }

     [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
     &lt;span style="color: blue"&gt;public void &lt;/span&gt;FactoryMethodExtensionLoadedStillResolvesNormally()
     {
         &lt;span style="color: blue"&gt;var &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityContainer&lt;/span&gt;();
         container.AddNewExtension&amp;lt;&lt;span style="color: #2b91af"&gt;FactoryMethodExtension&lt;/span&gt;&amp;gt;();
         container.RegisterType&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;();

         &lt;span style="color: blue"&gt;var &lt;/span&gt;resolve = container.Resolve&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;();

         &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.NotNull(resolve);
     }

     [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
     &lt;span style="color: blue"&gt;public void &lt;/span&gt;FactoryMethodExtensionWithContainerLifetimeResolvesSameInstances()
     {
         &lt;span style="color: blue"&gt;var &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityContainer&lt;/span&gt;();
         container.AddNewExtension&amp;lt;&lt;span style="color: #2b91af"&gt;FactoryMethodExtension&lt;/span&gt;&amp;gt;();
         container.Configure&amp;lt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration&lt;/span&gt;&amp;gt;()
             .RegisterFactory&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;(c =&amp;gt; &lt;span style="color: blue"&gt;new object&lt;/span&gt;(), &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ContainerControlledLifetimeManager&lt;/span&gt;());

         &lt;span style="color: blue"&gt;var &lt;/span&gt;first = container.Resolve&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;();
         &lt;span style="color: blue"&gt;var &lt;/span&gt;second = container.Resolve&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;();

         &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreSame(first, second);
     }

     [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
     &lt;span style="color: blue"&gt;public void &lt;/span&gt;FactoryMethodExtensionWithDefaultLifetimeResolvesDifferentInstances()
     {
         &lt;span style="color: blue"&gt;var &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityContainer&lt;/span&gt;();
         container.AddNewExtension&amp;lt;&lt;span style="color: #2b91af"&gt;FactoryMethodExtension&lt;/span&gt;&amp;gt;();
         container.Configure&amp;lt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration&lt;/span&gt;&amp;gt;()
             .RegisterFactory&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;(c =&amp;gt; &lt;span style="color: blue"&gt;new object&lt;/span&gt;());

         &lt;span style="color: blue"&gt;var &lt;/span&gt;first = container.Resolve&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;();
         &lt;span style="color: blue"&gt;var &lt;/span&gt;second = container.Resolve&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;();

         &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreNotSame(first, second);
     }

     [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
     &lt;span style="color: blue"&gt;public void &lt;/span&gt;FactoryMethodExtensionWithTransientLifetimeResolvesDifferentInstances()
     {
         &lt;span style="color: blue"&gt;var &lt;/span&gt;container = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UnityContainer&lt;/span&gt;();
         container.AddNewExtension&amp;lt;&lt;span style="color: #2b91af"&gt;FactoryMethodExtension&lt;/span&gt;&amp;gt;();
         container.Configure&amp;lt;&lt;span style="color: #2b91af"&gt;IFactoryMethodConfiguration&lt;/span&gt;&amp;gt;()
             .RegisterFactory&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;(c =&amp;gt; &lt;span style="color: blue"&gt;new object&lt;/span&gt;(), &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;TransientLifetimeManager&lt;/span&gt;());

         &lt;span style="color: blue"&gt;var &lt;/span&gt;first = container.Resolve&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;();
         &lt;span style="color: blue"&gt;var &lt;/span&gt;second = container.Resolve&amp;lt;&lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;();

         &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreNotSame(first, second);
     }
}&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/csWG6q3P9HVK3qlGb3JrtBYMatE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/csWG6q3P9HVK3qlGb3JrtBYMatE/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/csWG6q3P9HVK3qlGb3JrtBYMatE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/csWG6q3P9HVK3qlGb3JrtBYMatE/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/Phazed?a=ylT8YdUpogk:aOPRdakgq_U:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=ylT8YdUpogk:aOPRdakgq_U:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=ylT8YdUpogk:aOPRdakgq_U:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=ylT8YdUpogk:aOPRdakgq_U:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=ylT8YdUpogk:aOPRdakgq_U:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=ylT8YdUpogk:aOPRdakgq_U:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=ylT8YdUpogk:aOPRdakgq_U:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=ylT8YdUpogk:aOPRdakgq_U:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/ylT8YdUpogk" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/unity-and-the-factory-method-pattern/</feedburner:origLink></item><item><title>Feature Jealousy</title><link>http://feedproxy.google.com/~r/Phazed/~3/fj0iqYqHnoA/</link><pubDate>Wed, 25 Mar 2009 14:43:06 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/feature-jealousy/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>0</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;What’s got LINQ, but doesn’t have a &lt;a title="yield (C# reference)" href="http://msdn.microsoft.com/en-us/library/9k7k7cf0.aspx"&gt;yield&lt;/a&gt; keyword and no &lt;a title="Action Delegate" href="http://msdn.microsoft.com/en-us/library/018hxwa8.aspx"&gt;Action&lt;/a&gt; or multiline lambdas? What’s supposed to be an easy to learn language, but supports &lt;a title="Exception Filters" href="http://blogs.msdn.com/clrteam/archive/2009/02/05/catch-rethrow-and-filters-why-you-should-care.aspx"&gt;exception filters&lt;/a&gt; when other supposedly more complex languages don’t?&lt;/p&gt;  &lt;p&gt;The answer, VB.NET.&lt;/p&gt;  &lt;p&gt;“Co-evolution” has been &lt;a title="Co-evolution announced" href="http://blogs.msdn.com/ericnel/archive/2008/12/11/new-technical-article-on-visual-studio-2010-language-futures.aspx"&gt;announced&lt;/a&gt; for VB.NET 10.0 and C# 4.0. However, VB.NET doesn’t appear to be getting yield, and C# won’t be getting XML literals (which I personally think is a good thing).&lt;/p&gt;  &lt;p&gt;I think VB.NET shed the “Beginners” bit from &lt;a title="BASIC on Wikipedia" href="http://en.wikipedia.org/wiki/BASIC"&gt;BASIC&lt;/a&gt; a long time ago. What do you think?&lt;/p&gt; Oh, and whilst I’m at it, who’s up for an __il keyword in C# so you can have &lt;a title="Inline Assembler in C++" href="http://msdn.microsoft.com/en-us/library/45yd4tzz%28VS.80%29.aspx"&gt;inline blocks of IL&lt;/a&gt;?
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/-zxhyBqRXl5e4CIvI2h-khSY0rE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-zxhyBqRXl5e4CIvI2h-khSY0rE/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/-zxhyBqRXl5e4CIvI2h-khSY0rE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/-zxhyBqRXl5e4CIvI2h-khSY0rE/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/Phazed?a=fj0iqYqHnoA:i3_bsN3p2WA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=fj0iqYqHnoA:i3_bsN3p2WA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=fj0iqYqHnoA:i3_bsN3p2WA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=fj0iqYqHnoA:i3_bsN3p2WA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=fj0iqYqHnoA:i3_bsN3p2WA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=fj0iqYqHnoA:i3_bsN3p2WA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=fj0iqYqHnoA:i3_bsN3p2WA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=fj0iqYqHnoA:i3_bsN3p2WA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/fj0iqYqHnoA" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/feature-jealousy/</feedburner:origLink></item><item><title>Be afraid?</title><link>http://feedproxy.google.com/~r/Phazed/~3/nnEyMroMVJI/</link><pubDate>Wed, 25 Mar 2009 10:09:15 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/be-afraid/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>0</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;According to the BBC this morning, the UK government is proposing to &lt;a title="Social network sites &amp;#39;monitored&amp;#39;" href="http://news.bbc.co.uk/1/hi/uk/7962631.stm"&gt;monitor social networking sites&lt;/a&gt; like &lt;a title="Facebook" href="http://www.facebook.com/"&gt;Facebook&lt;/a&gt;, &lt;a title="Bebo" href="http://www.bebo.com/"&gt;Bebo&lt;/a&gt; and &lt;a title="MySpace" href="http://www.myspace.com/"&gt;MySpace&lt;/a&gt;. This comes the day after a report called for the government to &lt;a title="Call to scrap &amp;#39;illegal databases&amp;#39;" href="http://news.bbc.co.uk/1/hi/uk/7955205.stm"&gt;scrap a quarter of all their databases&lt;/a&gt; as they are illegal and should be redesigned. Included in this list of databases is the Communications Database which plans to centralise details of all phone calls made and websites visited, and is open to 510 public authorities. Just imagine what you could find out about people with a bit of clever data mining across these databases. What about joining up &lt;a title="Google Street View and the Terrorism Act" href="http://www.jamessnape.me.uk/blog/2009/03/20/GoogleStreetViewAndSection58OfTheTerrorismAct2000.aspx"&gt;other sources of information&lt;/a&gt; on the internet? What sort of information would you look up about yourself, friends or family? How would that differ from the sort of information that government departments or security services would want to look up? People are always curious about what other people are interested in.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/4-_P-8Vx0dkZWpeJjcKcL75wDCg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4-_P-8Vx0dkZWpeJjcKcL75wDCg/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/4-_P-8Vx0dkZWpeJjcKcL75wDCg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/4-_P-8Vx0dkZWpeJjcKcL75wDCg/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/Phazed?a=nnEyMroMVJI:qaJpwZV3tQM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=nnEyMroMVJI:qaJpwZV3tQM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=nnEyMroMVJI:qaJpwZV3tQM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=nnEyMroMVJI:qaJpwZV3tQM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=nnEyMroMVJI:qaJpwZV3tQM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=nnEyMroMVJI:qaJpwZV3tQM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/Phazed?a=nnEyMroMVJI:qaJpwZV3tQM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/Phazed?i=nnEyMroMVJI:qaJpwZV3tQM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/nnEyMroMVJI" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/be-afraid/</feedburner:origLink></item><item><title>Flexible Enumerations</title><link>http://feedproxy.google.com/~r/Phazed/~3/lojYeY0QZYs/</link><pubDate>Wed, 04 Feb 2009 20:40:27 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/flexible-enumerations/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>7</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;Sometimes enumerations in .NET just don’t cut it. In the end they’re just a numeric value to which a piece of string metadata is attached to some of the values. Consider the following enumerations:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OfficeLocationNames
&lt;/span&gt;{
    London,
    Edinburgh,
    Redmond
}

&lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OfficeLocationCodes
&lt;/span&gt;{
    LON,
    EDI,
    RED
}&lt;/pre&gt;

&lt;p&gt;What are these enumerations actually trying to say? I see these and think that there are three office locations, London, Edinburgh and Redmond, and each has a name and a three letter code, i.e. one type of thing, an office location, with two pieces of descriptive information about that thing, name and code. But using enumerations has forced us to define two things, when it’s really one. So what solutions are there?&lt;/p&gt;

&lt;p&gt;Here’s one solution I like. I’m sure there are more, so feel free to suggest variations or completely different patterns in the comments. First off I define an interface, IOfficeLocation, to specify what makes up an office location:&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IOfficeLocation
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;string &lt;/span&gt;Code { &lt;span style="color: blue"&gt;get&lt;/span&gt;; }
    &lt;span style="color: blue"&gt;string &lt;/span&gt;Name { &lt;span style="color: blue"&gt;get&lt;/span&gt;; }
    &lt;span style="color: blue"&gt;double &lt;/span&gt;Latitude { &lt;span style="color: blue"&gt;get&lt;/span&gt;; }
    &lt;span style="color: blue"&gt;double &lt;/span&gt;Longitude { &lt;span style="color: blue"&gt;get&lt;/span&gt;; }
}&lt;/pre&gt;

&lt;p&gt;I’ve taken the liberty of adding two more pieces of descriptive information to the office location too, latitude and longitude, just to prove the point. Note that this is &lt;a title="immutable" href="http://en.wikipedia.org/wiki/Immutable_object"&gt;immutable&lt;/a&gt;, i.e. you can’t change the values once they’ve been created.&lt;/p&gt;

&lt;p&gt;Next, I define the OfficeLocations static class that will be our container for the three possible office locations. Inside this class I define the OfficeLocation class, which is a concrete implementation of the IOfficeLocation interface. Again, this class is &lt;a title="immutable" href="http://en.wikipedia.org/wiki/Immutable_object"&gt;immutable&lt;/a&gt;, and importantly it’s a private class to the OfficeLocations static class. This ensures that only the OfficeLocations class can construct instances of the OfficeLocation class. Finally I define the three office locations as static read-only fields of the OfficeLocations class, all using the IOfficeLocation interface, but constructed from the private OfficeLocation class.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public static class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OfficeLocations
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;private class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OfficeLocation &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IOfficeLocation
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;private readonly string &lt;/span&gt;code;

        &lt;span style="color: blue"&gt;public &lt;/span&gt;OfficeLocation(&lt;span style="color: blue"&gt;string &lt;/span&gt;code, &lt;span style="color: blue"&gt;string &lt;/span&gt;name, &lt;span style="color: blue"&gt;double &lt;/span&gt;latitude, &lt;span style="color: blue"&gt;double &lt;/span&gt;longitude)
        {
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.code = code;
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.name = name;
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.latitude = latitude;
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.longitude = longitude;
        }

        &lt;span style="color: blue"&gt;private readonly string &lt;/span&gt;name;

        &lt;span style="color: blue"&gt;private readonly double &lt;/span&gt;latitude;

        &lt;span style="color: blue"&gt;private readonly double &lt;/span&gt;longitude;

        &lt;span style="color: blue"&gt;public string &lt;/span&gt;Code
        {
            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;code; }
        }

        &lt;span style="color: blue"&gt;public string &lt;/span&gt;Name
        {
            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;name; }
        }

        &lt;span style="color: blue"&gt;public double &lt;/span&gt;Latitude
        {
            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;latitude; }
        }

        &lt;span style="color: blue"&gt;public double &lt;/span&gt;Longitude
        {
            &lt;span style="color: blue"&gt;get &lt;/span&gt;{ &lt;span style="color: blue"&gt;return &lt;/span&gt;longitude; }
        }
    }

    &lt;span style="color: blue"&gt;public static readonly &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IOfficeLocation &lt;/span&gt;London = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OfficeLocation&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;LON&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;London&amp;quot;&lt;/span&gt;, 0d, 0d);
    &lt;span style="color: blue"&gt;public static readonly &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IOfficeLocation &lt;/span&gt;Edinburgh = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OfficeLocation&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;EDI&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;Edinburgh&amp;quot;&lt;/span&gt;, 0d, 0d);
    &lt;span style="color: blue"&gt;public static readonly &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IOfficeLocation &lt;/span&gt;Redmond = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OfficeLocation&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;MAN&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;Manchester&amp;quot;&lt;/span&gt;, 0d, 0d);
}&lt;/pre&gt;

&lt;p&gt;Using the OfficeLocations class is very similar to an enumeration, and because there is only ever one instance of London, Edinburgh and Redmond I can test for equality without needing to override the Equals method in the OfficeLocation class. I also like the fact that I cannot do more than or less than comparisons against office locations. It doesn’t make sense, to see if London is more than Edinburgh, does it? However, if it did I could implement IComparable on OfficeLocation and then I could make those comparisons.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;public bool &lt;/span&gt;IsInUnitedKingdom(&lt;span style="color: #2b91af"&gt;IOfficeLocation &lt;/span&gt;location)
{
    &lt;span style="color: blue"&gt;return &lt;/span&gt;(location == &lt;span style="color: #2b91af"&gt;OfficeLocations&lt;/span&gt;.London) || (location == &lt;span style="color: #2b91af"&gt;OfficeLocations&lt;/span&gt;.Edinburgh);
}&lt;/pre&gt;

&lt;p&gt;So, as usual, comments are always welcome. Are there any variations on this theme? Or perhaps issues with this implementation? Surely not!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Q-tcRjWNpJZIDIKlKZwL3A85kp4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q-tcRjWNpJZIDIKlKZwL3A85kp4/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/Q-tcRjWNpJZIDIKlKZwL3A85kp4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Q-tcRjWNpJZIDIKlKZwL3A85kp4/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/~f/Phazed?a=ISnSE39E"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=yyBz3Icq"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=yyBz3Icq" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=DXBp6cpk"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=DXBp6cpk" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=Jlm1V5X7"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=kiKHrZWd"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=kiKHrZWd" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/lojYeY0QZYs" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/flexible-enumerations/</feedburner:origLink></item><item><title>Snow Fun</title><link>http://feedproxy.google.com/~r/Phazed/~3/JBn8zw3ji_o/</link><pubDate>Tue, 03 Feb 2009 16:10:03 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/snow-fun/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>0</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;Well it won’t have escaped many readers from the UK (assuming I have readers outside the UK!) that it’s been snowing here, &lt;a title="Snow causing further disruption" href="http://news.bbc.co.uk/1/hi/uk/7866294.stm"&gt;quite a bit more&lt;/a&gt; than it would normally for this time of year! So Joanne and I took Isaac out for his first experience of snow. He, of course, slept through the whole walk through &lt;a title="Lily Hill Park" href="http://www.bracknell-forest.gov.uk/leisure/leis-parks-and-countryside/leis-parks-and-countryside-sites/leis-lily-hill-park.htm"&gt;Lily Hill Park&lt;/a&gt;, but here’s the photos for posterity.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0031_2.jpg"&gt;&lt;img style="display: inline" title="Joanne and Isaac" alt="Joanne and Isaac" src="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0031_thumb.jpg" width="244" height="181" /&gt;&lt;/a&gt;&amp;#160; &lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0032_2.jpg"&gt;&lt;img style="display: inline" title="Joanne and Isaac" alt="Joanne and Isaac" src="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0032_thumb.jpg" width="244" height="183" /&gt;&lt;/a&gt;&lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0033_2.jpg"&gt;&lt;img style="display: inline" title="Isaac in his parm" alt="Isaac in his parm" src="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0033_thumb.jpg" width="244" height="180" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;And just for good measure, here’s a couple of shots I took this morning waiting for a train from &lt;a title="Martins Heron" href="http://en.wikipedia.org/wiki/Martins_Heron_railway_station"&gt;Martins Heron&lt;/a&gt; into London. I think the pink hue is due to the fact that cameras in mobile phones don’t have UV filters!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0034_2.jpg"&gt;&lt;img style="display: inline" title="Martins Heron train station in the snow" alt="Martins Heron train station in the snow" src="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0034_thumb.jpg" width="244" height="180" /&gt;&lt;/a&gt;&lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0035_2.jpg"&gt;&lt;img style="display: inline" title="Martins Heron train station in the snow" alt="Martins Heron train station in the snow" src="http://phazed.com/files/media/image/WindowsLiveWriter/SnowFun_E33A/PIC-0035_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The train, by the way, did turn up on time, but arrived quite a bit late and was rammed full of people quite quickly. Obviously the &lt;a title="Wrong kind of snow" href="http://en.wikipedia.org/wiki/The_wrong_kind_of_snow"&gt;wrong kind of snow&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/flTj0Uc3p5nhQlbe_WZBF4GD5wE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/flTj0Uc3p5nhQlbe_WZBF4GD5wE/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/flTj0Uc3p5nhQlbe_WZBF4GD5wE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/flTj0Uc3p5nhQlbe_WZBF4GD5wE/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/~f/Phazed?a=K8RnOVoV"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=MB3foXz3"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=MB3foXz3" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=LcsfclQv"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=LcsfclQv" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=yyQP1HDg"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=5dU7tAYT"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=5dU7tAYT" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/JBn8zw3ji_o" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/snow-fun/</feedburner:origLink></item><item><title>And Can It Be…</title><link>http://feedproxy.google.com/~r/Phazed/~3/rDWnzmz2mTo/</link><pubDate>Tue, 03 Feb 2009 15:39:43 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/and-can-it-be-hellip/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>0</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;With apologies to &lt;a href="http://www.cyberhymnal.org/htm/a/c/acanitbe.htm"&gt;Charles Wesley&lt;/a&gt;.&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;My chain fell off,      &lt;br /&gt;My bike ran free,       &lt;br /&gt;Rolled down the hill into that tree.       &lt;br /&gt;My chain fell off,       &lt;br /&gt;My bike ran free,       &lt;br /&gt;Rolled down the hill into that tree.&lt;/p&gt;&lt;/blockquote&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vAjVl7Of-86MzoMNz0PsloFaJRc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vAjVl7Of-86MzoMNz0PsloFaJRc/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/vAjVl7Of-86MzoMNz0PsloFaJRc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vAjVl7Of-86MzoMNz0PsloFaJRc/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/~f/Phazed?a=BII1YWHw"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=oJrKIU5P"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=oJrKIU5P" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=qpsW37kG"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=qpsW37kG" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=qKNGmuq8"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=1DAKJQdb"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=1DAKJQdb" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/rDWnzmz2mTo" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/and-can-it-be-hellip/</feedburner:origLink></item><item><title>Isaac Michael Benbrook</title><link>http://feedproxy.google.com/~r/Phazed/~3/fF-rxMvN9H0/</link><pubDate>Wed, 14 Jan 2009 14:10:17 GMT</pubDate><guid isPermaLink="false">http://phazed.com/blog/isaac-michael-benbrook/</guid><dc:creator>Rupert Benbrook</dc:creator><slash:comments>16</slash:comments><category domain="http://phazed.com/blog/">Blog</category><description>&lt;p&gt;Joanne and I are pleased to announce that Isaac Michael Benbrook was born on the morning of Tuesday 13th January 2009 at 06:17, weighing 6lb 12oz. Both Mum and Isaac are doing really well, and needless to say we’re all deliriously happy!&lt;/p&gt;  &lt;p&gt;&lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/IsaacMichaelBenbrook_746F/2007Aug11-0212.jpg"&gt;&lt;img style="display: inline" title="Joanne &amp;amp; Isaac" alt="Joanne &amp;amp; Isaac" src="http://phazed.com/files/media/image/WindowsLiveWriter/IsaacMichaelBenbrook_746F/2007Aug11-0212_thumb.jpg" width="244" height="183" /&gt;&lt;/a&gt;&lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/IsaacMichaelBenbrook_746F/2007Aug11-0215.jpg"&gt;&lt;img style="display: inline" title="Isaac" alt="Isaac" src="http://phazed.com/files/media/image/WindowsLiveWriter/IsaacMichaelBenbrook_746F/2007Aug11-0215_thumb.jpg" width="244" height="177" /&gt;&lt;/a&gt;&lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/IsaacMichaelBenbrook_746F/2007Aug11-0220.jpg"&gt;&lt;img style="display: inline" title="Isaac Sleeping" alt="Isaac Sleeping" src="http://phazed.com/files/media/image/WindowsLiveWriter/IsaacMichaelBenbrook_746F/2007Aug11-0220_thumb.jpg" width="184" height="244" /&gt;&lt;/a&gt;&lt;a href="http://phazed.com/files/media/image/WindowsLiveWriter/IsaacMichaelBenbrook_746F/IMG_1138.jpg"&gt;&lt;img style="display: inline" title="Joanne &amp;amp; Isaac" alt="Joanne &amp;amp; Isaac" src="http://phazed.com/files/media/image/WindowsLiveWriter/IsaacMichaelBenbrook_746F/IMG_1138_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/nvNaiID4AnZJmTRqvQx_RlNJqHo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nvNaiID4AnZJmTRqvQx_RlNJqHo/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/nvNaiID4AnZJmTRqvQx_RlNJqHo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/nvNaiID4AnZJmTRqvQx_RlNJqHo/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/~f/Phazed?a=uhHhwWF6"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?d=41" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=R3Esk0rj"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=R3Esk0rj" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=tk9Psrsf"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=tk9Psrsf" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=DAOnCwJf"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?d=52" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~f/Phazed?a=fPKlnqjl"&gt;&lt;img src="http://feeds.feedburner.com/~f/Phazed?i=fPKlnqjl" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/Phazed/~4/fF-rxMvN9H0" height="1" width="1"/&gt;</description><georss:point>51.4141 0.7187</georss:point><feedburner:origLink>http://phazed.com/blog/isaac-michael-benbrook/</feedburner:origLink></item></channel></rss>
