<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Nicholas Blumhardt</title>
	<atom:link href="http://nblumhardt.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://nblumhardt.com</link>
	<description></description>
	<lastBuildDate>Tue, 21 May 2013 21:51:34 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>A discussion forum for Serilog</title>
		<link>http://nblumhardt.com/2013/05/a-discussion-forum-for-serilog/</link>
		<comments>http://nblumhardt.com/2013/05/a-discussion-forum-for-serilog/#comments</comments>
		<pubDate>Tue, 21 May 2013 21:51:34 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=397</guid>
		<description><![CDATA[If you&#8217;re curious about Serilog (or have a rant that might take more than the humble comment boxes below can accommodate) please drop in and say &#8220;hello&#8221;!]]></description>
				<content:encoded><![CDATA[<p>If you&#8217;re curious about <a href="http://serilog.net">Serilog</a> (or have a rant that might take more than the humble comment boxes below can accommodate) please <a href="https://groups.google.com/forum/?fromgroups#!forum/serilog">drop in and say &#8220;hello&#8221;!</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2013/05/a-discussion-forum-for-serilog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A console sink with property colouring</title>
		<link>http://nblumhardt.com/2013/05/serilog-colored-console-sink/</link>
		<comments>http://nblumhardt.com/2013/05/serilog-colored-console-sink/#comments</comments>
		<pubDate>Thu, 09 May 2013 12:14:45 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=389</guid>
		<description><![CDATA[The coloured console &#8216;appender&#8217; is one of my favourites in log4net, so high on the list for inclusion in Serilog. Smart property highlighting makes the result quite interesting: You can use it on the full .NET Framework using the out-of-the-box Serilog 0.2.8 package. Log.Logger = new LoggerConfiguration&#40;&#41; &#160; &#160; .WriteTo.ColoredConsole&#40;&#41; &#160; &#160; .CreateLogger&#40;&#41;; Simple at&#8230;]]></description>
				<content:encoded><![CDATA[<p>The coloured console &#8216;appender&#8217; is one of my favourites in log4net, so high on the list for inclusion in <a href="http://serilog.net">Serilog</a>.</p>
<p>Smart property highlighting makes the result quite interesting:</p>
<p><a href="http://nblumhardt.com/wp-content/uploads/2013/05/ColoredConsoleSinkDemo.png"><img src="http://nblumhardt.com/wp-content/uploads/2013/05/ColoredConsoleSinkDemo.png" alt="ColoredConsoleSinkDemo" width="762" height="431" class="aligncenter size-full wp-image-392" /></a></p>
<p>You can use it on the full .NET Framework using the out-of-the-box <a href="http://nuget.org/packages/serilog">Serilog 0.2.8 package</a>.</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:800px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Log<span style="color: #008000;">.</span><span style="color: #0000FF;">Logger</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LoggerConfiguration<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">WriteTo</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ColoredConsole</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">CreateLogger</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>Simple at this stage, but fun! What do you think?</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2013/05/serilog-colored-console-sink/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Changes in Serilog 0.2</title>
		<link>http://nblumhardt.com/2013/04/changes-in-serilog-0-2/</link>
		<comments>http://nblumhardt.com/2013/04/changes-in-serilog-0-2/#comments</comments>
		<pubDate>Mon, 08 Apr 2013 12:35:46 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=380</guid>
		<description><![CDATA[Thanks for all the feedback on Serilog, keep it coming! Version 0.2 is now on NuGet and introduces a couple of noticeable changes. Phone and tablet support The core of Serilog is now portable across .NET 4.5, Windows 8 and Windows Phone 8. The latter two platforms only include one &#8216;sink&#8217; out of the box,&#8230;]]></description>
				<content:encoded><![CDATA[<p><a style="display: block; float: right" href="http://serilog.net"><img alt="Serilog" src="http://serilog.net/images/serilog-logo-64.png" style="padding-left 20px" /></a></p>
<p>Thanks for all the feedback on Serilog, keep it coming! Version 0.2 is now on <a href="https://nuget.org/packages/Serilog/">NuGet</a> and introduces a couple of noticeable changes.</p>
<h4>Phone and tablet support</h4>
<p>The core of Serilog is now portable across .NET 4.5, Windows 8 and Windows Phone 8.</p>
<p><a href="http://nblumhardt.com/wp-content/uploads/2013/04/Serilog-on-WP8.png"><img src="http://nblumhardt.com/wp-content/uploads/2013/04/Serilog-on-WP8.png" alt="Serilog on WP8" width="512" height="398" class="aligncenter size-full wp-image-381" /></a></p>
<p>The latter two platforms only include one &#8216;sink&#8217; out of the box, that writes to a <code class="codecolorer text default"><span class="text">System.IO.TextWriter</span></code>. I&#8217;d like to set up sinks for local storage on those platforms, if you&#8217;re knowledgeable (or brave!) and interested in helping out.</p>
<h4>Revised configuration API</h4>
<p>The first version of <code class="codecolorer text default"><span class="text">LoggerConfiguration</span></code> used flat method chaining to drive the configuration process.</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:800px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Log<span style="color: #008000;">.</span><span style="color: #0000FF;">Logger</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LoggerConfiguration<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">MinimumLevel</span><span style="color: #008000;">&#40;</span>LogEventLevel<span style="color: #008000;">.</span><span style="color: #0000FF;">Debug</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">WithConsoleSink</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">CreateLogger</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>The number of methods on <code class="codecolorer text default"><span class="text">LoggerConfiguration</span></code> became unwieldy quickly. On typing &#8216;.&#8217;, a user would be presented with everything including <code class="codecolorer text default"><span class="text">.WithKitchenSink()</span></code>.</p>
<p>0.2 aims at a cleaner IntelliSense experience by grouping options:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:800px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Log<span style="color: #008000;">.</span><span style="color: #0000FF;">Logger</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LoggerConfiguration<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">MinimumLevel</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Debug</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">WriteTo</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Console</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">CreateLogger</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>In addition to <code class="codecolorer text default"><span class="text">MinimumLevel</span></code> and <code class="codecolorer text default"><span class="text">WriteTo</span></code>, you can configure Serilog to <code class="codecolorer text default"><span class="text">Filter</span></code> log events based on arbitrary rules, <code class="codecolorer text default"><span class="text">Enrich</span></code> log events with properties calculated at runtime, and <code class="codecolorer text default"><span class="text">Destructure</span></code> complex parameter types for serialization various ways.</p>
<p>There are advantages and disadvantages to any API, for the moment I&#8217;m happy with this direction but open to suggestions (give it a try!) Thanks <a href="https://twitter.com/droyad">@droyad</a>, <a href="https://twitter.com/uglybugger">@uglybugger</a> and <a href="https://twitter.com/turtlator">@turtlator</a> for the motivation and first round of feedback.</p>
<h4>Control over &#8216;destructuring&#8217;</h4>
<p>The new version survives the serialization of circular object graphs and offers more control over the serialization process. For example, only a selection of properties from <code class="codecolorer text default"><span class="text">HttpRequestMessage</span></code> might be included in a log event:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:800px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Log<span style="color: #008000;">.</span><span style="color: #0000FF;">Logger</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LoggerConfiguration<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">Destructure</span><span style="color: #008000;">.</span><span style="color: #0000FF;">ByTransforming</span><span style="color: #008000;">&lt;</span>HttpRequestMessage<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; m <span style="color: #008000;">=&gt;</span> <span style="color: #008000;">new</span> <span style="color: #008000;">&#123;</span> Uri <span style="color: #008000;">=</span> m<span style="color: #008000;">.</span><span style="color: #0000FF;">RequestUri</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AbsoluteUri</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m<span style="color: #008000;">.</span><span style="color: #0000FF;">Method</span>,<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;m<span style="color: #008000;">.</span><span style="color: #0000FF;">Headers</span> <span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">...</span><br />
<br />
<span style="color: #0000FF;">Log</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Debug</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Received {@Message}&quot;</span>, httpRequestMessage<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>Thanks <a href="https://twitter.com/sandcastle_hq">@sandcastle_hq</a> for putting the momentum behind this.</p>
<p>(Quick note on terminology, Serilog breaks down objects in two phases; <em>destructuring</em> controls the tree created out of regular .NET objects, while <em>serialization</em> is specific to the sink being used, for example converting that tree structure into JSON.)</p>
<h4>What&#8217;s next?</h4>
<p>Use, feedback, documentation, performance profiling and tuning, more sinks.</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2013/04/changes-in-serilog-0-2/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Serilog</title>
		<link>http://nblumhardt.com/2013/03/serilog/</link>
		<comments>http://nblumhardt.com/2013/03/serilog/#comments</comments>
		<pubDate>Fri, 29 Mar 2013 11:01:17 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=334</guid>
		<description><![CDATA[Serilog is a new logging library for .NET that combines the best of &#8220;traditional&#8221; and &#8220;structured&#8221; approaches. Instrumentation vs. analysis: different goals, different requirements Application logs are rich with analysable data, but forces at play during the early phases of application development encourage trade-offs that limit the practicality of consuming them later on. In their&#8230;]]></description>
				<content:encoded><![CDATA[<p><a style="display: block; float: right" href="http://serilog.net"><img alt="Serilog" src="http://serilog.net/images/serilog-logo-64.png" style="padding-left 20px" /></a></p>
<p><a href="http://serilog.net">Serilog</a> is a new logging library for .NET that combines the best of &#8220;traditional&#8221; and &#8220;structured&#8221; approaches.</p>
<h4>Instrumentation vs. analysis: different goals, different requirements</h4>
<p>Application logs are rich with analysable data, but forces at play during the early phases of application development encourage trade-offs that limit the practicality of consuming them later on.</p>
<p>In their primary role as instrumentation, log entries must be effortless to write and comfortable to read, thus text-message-based logging formats remain more popular than <a href="http://blogs.msdn.com/b/agile/archive/2013/02/07/embracing-semantic-logging.aspx">schematised approaches</a> today.</p>
<p>Event analysis later in the application lifecyle then tends to rely on fitting a more structured event stream to the application, or parsing log messages using regular expressions to recover fields from the event.</p>
<p>Serilog avoids this compromise by rethinking how log messages are processed.</p>
<h4>Simple, familiar instrumentation</h4>
<p>On the surface, Serilog will be familiar to users of nearly any .NET logging library:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:800px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Log<span style="color: #008000;">.</span><span style="color: #0000FF;">Logger</span> <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> LoggerConfiguration<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">WithFileSink</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;applog.txt&quot;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">CreateLogger</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
<br />
Log<span style="color: #008000;">.</span><span style="color: #0000FF;">Information</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;Hello, world!&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>This example writes a line like the following to <code class="codecolorer text default"><span class="text">applog.txt</span></code>.</p>
<div class="codecolorer-container text default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:800px;"><div class="text codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">2013-03-29 20:46:12 [Information] Hello, world!</div></div>
<p>Most of the bread-and-butter features you&#8217;d expect from a logging library are supported or planned.</p>
<h4>Message parameters as structured data</h4>
<p>The significant difference is in how message parameters are captured. While traditional logging libraries render messages into strings before processing, Serilog defers rendering and captures the parameters separately from the message template:</p>
<p><a href="http://nblumhardt.com/wp-content/uploads/2013/03/SerilogLog.png"><img src="http://nblumhardt.com/wp-content/uploads/2013/03/SerilogLog.png" alt="SerilogLog" width="850" height="653" class="aligncenter size-full wp-image-345" /></a></p>
<p>The log event, rather than being represented by a textual message, is captured as a <code class="codecolorer text default"><span class="text">MessageTemplate</span></code> along with two properties, <code class="codecolorer text default"><span class="text">SensorInput</span></code> and <code class="codecolorer text default"><span class="text">Time</span></code>.</p>
<p>Later in processing the message can be rendered as text for an output mechanism like a log file. Or, the structured event describing the log message may be stored as-is in a NoSQL database like <a href="http://couchdb.apache.org">CouchDB</a> or <a href="http://ravendb.net">RavenDB</a>. Writing to a document data store is where the strength of Serilog kicks in.</p>
<p>In this example, the <code class="codecolorer text default"><span class="text">@</span></code> in front of the <code class="codecolorer text default"><span class="text">SensorInput</span></code> property name instructs Serilog to preserve the structure of the object, breaking it down into <code class="codecolorer text default"><span class="text">Lat</span></code> and <code class="codecolorer text default"><span class="text">Long</span></code> properties (for some examples showing why this is great see this discussion). The resulting document embeds the structure, rather than a string representation:</p>
<p><a href="http://nblumhardt.com/wp-content/uploads/2013/03/Couch.png"><img src="http://nblumhardt.com/wp-content/uploads/2013/03/Couch.png" alt="Couch" width="696" height="438" class="aligncenter size-full wp-image-354" /></a></p>
<p>This is the core value proposition of the Serilog &#8211; <strong>build your application with all the advantages of simple text based logging, then seamlessly enable structured log analysis later on by adding a capable data store.</strong></p>
<h4>The project</h4>
<p>Is Serilog ready for prime time? It depends on your willingness to tinker. The project is coming togrether, but there are numerous rough edges and nice-to-have features missing. Notably, there’s no XML configuration story out of the box. If you have a chance to <a href="http://nuget.org/packages/serilog">kick the tyres</a> I&#8217;d love to hear what you think.</p>
<p>Is yet-another-logging-library just a serious case of “not invented here”? I think that the log structure problem is yet to be completely solved, and that it needs to be. If you feel the same way, please get in touch – <a href="http://github.com/nblumhardt/serilog">all help appreciated</a>!</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2013/03/serilog/feed/</wfw:commentRss>
		<slash:comments>17</slash:comments>
		</item>
		<item>
		<title>Autofac update 2.6.1 published</title>
		<link>http://nblumhardt.com/2012/03/autofac-update-2-6-1-published/</link>
		<comments>http://nblumhardt.com/2012/03/autofac-update-2-6-1-published/#comments</comments>
		<pubDate>Mon, 05 Mar 2012 15:55:20 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=326</guid>
		<description><![CDATA[The eagle-eyed may have already spotted Autofac 2.6.1 lurking in the NuGet feed. The last release, the venerable 2.5.2, served us very well (maturity is a feature!) and this release adds a little more polish, without any known breaking changes. The ASP.NET MVC integration package gets a bug fix for recursive views, UrlHelper and RequestContext&#8230;]]></description>
				<content:encoded><![CDATA[<p>The eagle-eyed may have already spotted <a href='http://nuget.org/packages/Autofac'>Autofac 2.6.1</a> lurking in the NuGet feed.</p>
<p>The last release, the venerable 2.5.2, served us very well (maturity is a feature!) and this release adds a little more polish, without any known breaking changes.</p>
<ul>
<li>The <a href='http://nuget.org/packages?q=autofac.mvc3'>ASP.NET MVC integration package</a> gets a bug fix for recursive views, <code class="codecolorer text default"><span class="text">UrlHelper</span></code> and <code class="codecolorer text default"><span class="text">RequestContext</span></code> registered by <code class="codecolorer text default"><span class="text">AutofacWebTypesModule</span></code>, and an explicit method for registering model binders.</li>
<li>The <a href='http://nuget.org/packages/Autofac.Wcf'>WCF integration package</a> gets much improved support for services with <code class="codecolorer text default"><span class="text">InstanceContextMode.Single</span></code>.</li>
<li>A new helper <code class="codecolorer text default"><span class="text">InstancePerOwned&lt;T&gt;()</span></code> makes it easier to control lifetime when using <code class="codecolorer text default"><span class="text">Owned&lt;T&gt;</span></code>.</li>
<li>Autofac can now be used with <a href='http://msdn.microsoft.com/en-us/library/gg597391.aspx'>.NET Portable Class Libraries</a> (download only on <a href='http://code.google.com/p/autofac/downloads/detail?name=Autofac-2.6.1.841-Portable.zip'>the project site</a>. (The Windows Phone 7 build now uses this configuration too.)</li>
<li><code class="codecolorer text default"><span class="text">Autofac.dll</span></code> is now clear of any issues found by <a href='http://msdn.microsoft.com/en-us/library/dd997356.aspx'>SecAnnotate.exe</a>.</li>
</ul>
<p>Extra thanks to <a href='http://alexmg.com/'>Alex</a> and <a href='http://www.paraesthesia.com/'>Travis</a> for the majority of these improvements.</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2012/03/autofac-update-2-6-1-published/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Convention-based part registration available in a new MEF preview!</title>
		<link>http://nblumhardt.com/2011/10/convention-based-part-registration-available-in-a-new-mef-preview/</link>
		<comments>http://nblumhardt.com/2011/10/convention-based-part-registration-available-in-a-new-mef-preview/#comments</comments>
		<pubDate>Fri, 28 Oct 2011 20:24:20 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=320</guid>
		<description><![CDATA[There are many, many similarities between IoC-for-decoupling (as we know and love in Autofac) and IoC-for-extensibility as is implemented by MEF. One thing that stuck out in the beginning for the MEF project members with IoC backgrounds, was the verbosity of using [Import] and [Export] attributes to describe parts, instead of the much more terse&#8230;]]></description>
				<content:encoded><![CDATA[<p>There are many, many similarities between IoC-for-decoupling (as we know and love in <a href='http://autofac.org'>Autofac</a>) and IoC-for-extensibility as is implemented by <a href='http://mef.codeplex.com'>MEF</a>.</p>
<p>One thing that stuck out in the beginning for the MEF project members with IoC backgrounds, was the verbosity of using <code class="codecolorer text default"><span class="text">[Import]</span></code> and <code class="codecolorer text default"><span class="text">[Export]</span></code> attributes to describe parts, instead of the much more terse convention-driven approach used by IoC containers.</p>
<p>Over time, most of us grew to appreciate the role that the attributed programming model played in creating an unambiguous, decentralized configuration mechanism for plug-ins.</p>
<p>What the we also found was that applications using MEF for extensibility would also use it for internal composition, a-la IoC. In the much more controlled context of the host application, the lighter, more direct, convention-driven configuration model is compelling. DRY is one of the most important principles for building maintainable software, so techniques that eliminate repetition are very valuable.</p>
<p>It should be no surprise then, that the latest release of MEF (that I’ve only recently had any involvement in) comes with a nifty little model for defining parts by convention. The syntax should be familiar if you’re used to this kind of API:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:800px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">var builder <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> RegistrationBuilder<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span><br />
builder<span style="color: #008000;">.</span><span style="color: #0000FF;">ForTypesDerivedFrom</span><span style="color: #008000;">&lt;</span>Controller<span style="color: #008000;">&gt;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">Export</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">.</span><span style="color: #0000FF;">SetCreationPolicy</span><span style="color: #008000;">&#40;</span>CreationPolicy<span style="color: #008000;">.</span><span style="color: #0000FF;">NonShared</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span></div></div>
<p>When wired up to a MEF catalog, these simple conventions will read a part like:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:800px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> HomeController <span style="color: #008000;">:</span> &nbsp;Controller<br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> HomeController<span style="color: #008000;">&#40;</span><span style="color: #008080; font-style: italic;">/* Dependencies here */</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> … <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> ActionResult Index<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> … <span style="color: #008000;">&#125;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p>As:</p>
<div class="codecolorer-container csharp default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:800px;"><div class="csharp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #008000;">&#91;</span>Export, PartCreationPolicy<span style="color: #008000;">&#40;</span>CreationPolicy<span style="color: #008000;">.</span><span style="color: #0000FF;">NonShared</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#93;</span><br />
<span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> HomeController <span style="color: #008000;">:</span> &nbsp;Controller<br />
<span style="color: #008000;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #008000;">&#91;</span>ImportingConstructor<span style="color: #008000;">&#93;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> HomeController<span style="color: #008000;">&#40;</span><span style="color: #008080; font-style: italic;">/* Dependencies here */</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> … <span style="color: #008000;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #0600FF; font-weight: bold;">public</span> ActionResult Index<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span> … <span style="color: #008000;">&#125;</span><br />
<span style="color: #008000;">&#125;</span></div></div>
<p><code class="codecolorer text default"><span class="text">RegistrationBuilder</span></code> has more than a few tricks up its sleeve, and we expect to write a lot more about it on the <a href='http://blogs.msdn.com/b/bclteam/'>BCL team blog</a> in the coming weeks. For now, you can <a href='http://blogs.msdn.com/b/bclteam/archive/2011/10/27/what-s-new-in-mef-version-2-preview-4.aspx'>read about the new release</a>, or even better, <a href='http://mef.codeplex.com/releases/view/75766'>download the preview source and binaries</a> from CodePlex.</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2011/10/convention-based-part-registration-available-in-a-new-mef-preview/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Autofac 2.5 Released</title>
		<link>http://nblumhardt.com/2011/07/autofac-2-5-released/</link>
		<comments>http://nblumhardt.com/2011/07/autofac-2-5-released/#comments</comments>
		<pubDate>Sun, 10 Jul 2011 22:53:23 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=312</guid>
		<description><![CDATA[Autofac 2.5 is now available on the project site and via NuGet. The new version includes a range of great contributions. After incubation as an external project, Windows Phone 7 now joins ranks of officially-supported targets (just install the Autofac package via NuGet and you&#8217;re up and running!) For some tips on getting started see&#8230;]]></description>
				<content:encoded><![CDATA[<p>Autofac 2.5 is now available on the <a href='http://autofac.org'>project site</a> and via <a href='http://nuget.org'>NuGet</a>. The new version includes a range of great contributions.</p>
<p>After incubation as an <a href='http://www.kowitz.net/autofac-on-wp7'>external project</a>, <a href='http://www.microsoft.com/windowsphone'>Windows Phone 7</a> now joins ranks of officially-supported targets (just install the <code class="codecolorer text default"><span class="text">Autofac</span></code> package via NuGet and you&#8217;re up and running!) For some tips on getting started see <a href='http://www.kowitz.net/configuring-autofac-for-wp7?utm_source=Silverlight-Zone.com&#038;utm_medium=SilverlightZone&#038;utm_campaign=kunal2383'>Brendan Kowitz&#8217;s notes</a>.</p>
<p>The new release is highly-compatible with Autofac 2.4 (best used with the VS2010 compiler when targeting .NET 3.5.)</p>
<p>Included changes are:</p>
<ul>
<li>Issue 329 &#8211; types are filtered by compatibilty before invoking key mapping functions when scanning assemblies</li>
<li><code class="codecolorer text default"><span class="text">RegisterAssemblyTypes(...).WithMetadataFrom&lt;T&gt;()</span></code> simplifies extraction of metadata from attribute properties</li>
<li><code class="codecolorer text default"><span class="text">Module.ThisAssembly</span></code> simplifies implementation of modules that scan their own assembly</li>
<li>Issue 333 &#8211; enable <code class="codecolorer text default"><span class="text">RegisterAssemblyTypes(...).PreserveExistingDefaults()</span></code></li>
<li>Windows Phone 7 and 7.1 support</li>
<li>Issue 312 &#8211; allow <code class="codecolorer text default"><span class="text">ContainerBuilder.Update()</span></code> on the <code class="codecolorer text default"><span class="text">ComponentRegistry</span></code> of any<br />
<code class="codecolorer text default"><span class="text">ILifetimeScope</span></code> without affecting the parent scope</li>
<li>Issue 327 &#8211; allow autowiring of enum properties</li>
<li>Issue 319 &#8211; support list and dictionary literals in XML configuration</li>
<li>Issue 330 &#8211; corrections to generic type constraint checking where the constraint type is an interface</li>
<li>Issue 331 &#8211; fix build warnings and runtime issues using Moq integration</li>
<li>Introduced <code class="codecolorer text default"><span class="text">ContainerBuildOptions</span></code> to control invocation of <code class="codecolorer text default"><span class="text">IStartable.Start()</span></code> under unit tests</li>
<li><code class="codecolorer text default"><span class="text">Container.Empty</span></code> is now a property rather than a field (protection from inadvertent updates</li>
<li>Removed broken/obsolete examples from source tree (better examples are available elsewhere online)</li>
<li>Host configuration features for <code class="codecolorer text default"><span class="text">AutofacHostFactory</span></code> in WCF integration</li>
<li><code class="codecolorer text default"><span class="text">ComponentRegistry.Register()</span></code> is now safe for use under multiple threads</li>
<li>Issue 227 &#8211; <strong>breaking change</strong> additional options (and enum rather than boolean parameter) for <code class="codecolorer text default"><span class="text">PropertiesAutowired()</span></code></li>
<li>Additional web abstractions are now registered by the MVC3 <code class="codecolorer text default"><span class="text">AutofacWebTypesModule</span></code></li>
<li>Issue 311 &#8211; fixed potential lifetime issues when injecting into MVC filter attributes</li>
<li>Tightened up behavior when correct constructor to use under reflection activator is ambiguous (now throws rather than choosing nondeterministically)</li>
<li>Issue 309 &#8211; fixed some issues in <code class="codecolorer text default"><span class="text">TypeExtensions.IsClosedTypeOf()</span></code></li>
<li>Improved exception messages</li>
</ul>
<p>Many thanks to the <a href='http://code.google.com/p/autofac/people/list'>Autofac project team</a> and collaborators across the web for making this release happen!</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2011/07/autofac-2-5-released/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>Designing a Short Course on IoC: Day 5</title>
		<link>http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-5/</link>
		<comments>http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-5/#comments</comments>
		<pubDate>Thu, 24 Mar 2011 23:09:01 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=309</guid>
		<description><![CDATA[The last of this curious series of journal entries today. As I mentioned previously, today is going to be about finalising the end-to-end flow of topics. I think the first session &#8211; Fundamentals &#8211; is finished. I&#8217;m really excited and even a little nervous about putting together a new container on the fly! As a&#8230;]]></description>
				<content:encoded><![CDATA[<p>The last of this curious series of journal entries today. As I mentioned <a href='http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-4/'>previously</a>, today is going to be about finalising the end-to-end flow of topics.</p>
<p>I think the first session &#8211; Fundamentals &#8211; is finished. I&#8217;m really excited and even a little nervous about putting together a new container on the fly! As a way of bedding down the terminology, mechanics and challenges, I think it is going to be great.</p>
<p>The layout for the remainder of the day still needs work, so I&#8217;d better get stuck into it! Those who&#8217;ve already signed up, I&#8217;ll see you soon &#8211; if you haven&#8217;t put your name down yet for either <a href='http://readify.net/our-events?event-id=62A62934-5215-43FB-9EC4-7F3BF6E058CD'>Brisbane</a>, <a href='http://readify.net/our-events?event-id=9DC9D217-CD23-4A11-90ED-1727E99C1018'>Sydney</a> or <a href='http://readify.net/our-events?event-id=37574063-A9C0-41C9-A4C7-2A6ED6D82DB0'>Melbourne</a>, this is probably the last reminder you&#8217;ll get from me.</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-5/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Designing a Short Course on IoC: Day 4</title>
		<link>http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-4/</link>
		<comments>http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-4/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 23:33:52 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=304</guid>
		<description><![CDATA[A brief update today. Yesterday I think I covered everything I need to as far as demo app material goes, but tidying up, styling and (egads!) unit testing will have to wait for a rainy day. I spent a fair bit of time yesterday looking at how I can use Whitebox to give an x-ray&#8230;]]></description>
				<content:encoded><![CDATA[<p>A brief update today. <a href='http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-3/'>Yesterday</a> I think I covered everything I need to as far as demo app material goes, but tidying up, styling and (egads!) unit testing will have to wait for a rainy day.</p>
<p>I spent a fair bit of time yesterday looking at how I can use <a href='http://whitebox.googlecode.com'>Whitebox</a> to give an x-ray view of the composition process as the application is built. The information it provides is great &#8211; often revealing little issues that would otherwise go unnoticed &#8211; but the usability leaves me deeply unsatisfied. Still, it <em>is</em> a start, and by chipping away at it things are improving. Just having a simple view of component details is an improvement:</p>
<p><a href="http://nblumhardt.com/wp-content/uploads/2011/03/Capture.png"><img src="http://nblumhardt.com/wp-content/uploads/2011/03/Capture.png" alt="Whitebox component detail view" title="Component Detail" width="493" height="216" class="aligncenter size-full wp-image-306" /></a></p>
<p>Today I&#8217;m concentrating on the flow of the day. I still have some questions to answer around the introductory session &#8211; how theoretical do we want to get? Does it make sense to examine the problems of composition in OO languages, or can we take that as a given for people interested in learning more about IoC? My tendency in the past would have been to go into depth about this, but by starting with &#8220;you&#8217;re going to use IoC &#8211; here&#8217;s how to do it&#8221; I think the practical side of the Dev Day will be emphasised.</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-4/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Designing a Short Course on IoC: Day 3</title>
		<link>http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-3/</link>
		<comments>http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-3/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 23:59:33 +0000</pubDate>
		<dc:creator>Nicholas Blumhardt</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://nblumhardt.com/?p=300</guid>
		<description><![CDATA[Is it just me, or am I slowing down? Yesterday was a busy day of programming, but there&#8217;s still a long way to go before this application is going to cut the mustard as an example for the course. In the end, I went with the idea of a timesheeting application. Simple material keeps out&#8230;]]></description>
				<content:encoded><![CDATA[<p>Is it just me, or am I slowing down? <a href='http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-2/'>Yesterday</a> was a busy day of programming, but there&#8217;s still a <em>long</em> way to go before this application is going to cut the mustard as an example for the course.</p>
<p>In the end, I went with the idea of a timesheeting application. Simple material keeps out of the way, and to be honest, there is so little logic or fancy presentation in this app that it could be changed from timesheets to another example in a relatively short space of time if need be.</p>
<p>Up and running, we have:</p>
<ul>
<li>A basic MVC3 app layout</li>
<li>IoC set up to create controllers</li>
<li>Data access with <a href='http://nhibernate.org'>NHibernate</a></li>
<li>Transaction management integrated with MVC</li>
<li>Logging with the venerable <a href='http://logging.apache.org/log4net/index.html'>log4net</a></li>
<li>A skeleton for &#8216;pick-me-up&#8217; domain events</li>
</ul>
<p>It is the last item that I&#8217;ll be working on in depth today. <em>&#8216;Pick-me-up&#8217; domain events</em> integrate domain models with external services in a way that plays better with IoC than the thread-static <code class="codecolorer text default"><span class="text">DomainEvents.Raise()</span></code> pattern commonly seen elsewhere.</p>
<p>Dispatching events to handlers is also a good example of the &#8216;generic handler&#8217; pattern that&#8217;s very widely used, and registering handlers will provide some further examples for convention-based/scanning registration.</p>
<p>To complete the day I&#8217;m aiming to polish up the last details of the basic MVC site (for example, error handling) and bed down an example of processing work in a background process to use in the &#8220;Resources and Units of Work&#8221; session. That leaves tomorrow and Friday for more detailed work on slides, some code samples for the &#8220;Containers&#8221; session, and some reworking of the example to fit into the flow of the course.</p>
]]></content:encoded>
			<wfw:commentRss>http://nblumhardt.com/2011/03/designing-a-short-course-on-ioc-day-3/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
