<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:copyright="http://blogs.law.harvard.edu/tech/rss" xmlns:image="http://purl.org/rss/1.0/modules/image/">
    <channel>
        <title>Code Gallery</title>
        <link>http://geekswithblogs.net/EltonStoneman/category/8867.aspx</link>
        <description>Code Gallery</description>
        <language>en-GB</language>
        <copyright>Elton Stoneman</copyright>
        <managingEditor>comments@sixeyed.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <item>
            <title>Passthrough Objects – Duck Typing++</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2010/05/13/passthrough-objects--duck-typing.aspx</link>
            <description>&lt;p style="text-align: center"&gt;&lt;span style="font-size: 10pt"&gt;[Source: &lt;a href="http://geekswithblogs.net/EltonStoneman"&gt;http://geekswithblogs.net/EltonStoneman&lt;/a&gt;] &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Can't see a genuine use for this, but I got the idea in my head and wanted to work it through. It's an extension to the idea of duck typing, for scenarios where types have similar behaviour, but implemented in differently-named members.&lt;/p&gt;
&lt;p&gt;So you may have a set of objects you want to treat as an interface, which don't implement the interface explicitly, and don't have the same member names so they can't be duck-typed into implicitly implementing the interface. In a fictitious example, I want to call &lt;strong&gt;&lt;em&gt;Get&lt;/em&gt;&lt;/strong&gt; on whichever &lt;strong&gt;ICache&lt;/strong&gt; implementation is current, and have the call passed through to the relevant method – whether it's called &lt;strong&gt;&lt;em&gt;Read&lt;/em&gt;&lt;/strong&gt;, &lt;strong&gt;&lt;em&gt;Retrieve&lt;/em&gt;&lt;/strong&gt; or whatever:&lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://geekswithblogs.net/images/geekswithblogs_net/eltonstoneman/051310_1851_Passthrough1.png" /&gt;&lt;/p&gt;
&lt;p&gt;A sample implementation is up on github here: &lt;a href="http://github.com/sixeyed/codegallery/tree/master/PassthroughSample/"&gt;PassthroughSample&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This uses Castle's DynamicProxy behind the scenes in the same way as my &lt;a href="http://geekswithblogs.net/EltonStoneman/archive/2009/10/21/duck-typing-with-castle.aspx"&gt;duck typing sample&lt;/a&gt;, but allows you to configure the passthrough to specify how the inner (implementation) and outer (interface) members are mapped:&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;    &lt;span style="color: blue"&gt;var&lt;/span&gt; setup = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Passthrough&lt;/span&gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;    &lt;span style="color: blue"&gt;var&lt;/span&gt; cache = setup.Create(&lt;span style="color: #a31515"&gt;"PassthroughSample.Tests.Stubs.AspNetCache, PassthroughSample.Tests"&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;                            .WithPassthrough(&lt;span style="color: #a31515"&gt;"Name"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"CacheName"&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;                            .WithPassthrough(&lt;span style="color: #a31515"&gt;"Get"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"Retrieve"&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;                            .WithPassthrough(&lt;span style="color: #a31515"&gt;"Set"&lt;/span&gt;, &lt;span style="color: #a31515"&gt;"Insert"&lt;/span&gt;)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;                            .As&amp;lt;&lt;span style="color: #2b91af"&gt;ICache&lt;/span&gt;&amp;gt;();&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;- or using some ugly Lambdas to avoid the strings :&lt;/p&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;    &lt;span style="color: #2b91af"&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;ICache&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; get = (o, s) =&amp;gt; o.Get(s);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;    &lt;span style="color: #2b91af"&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Memcached&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; read = (i, s) =&amp;gt; i.Read(s);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;    &lt;span style="color: #2b91af"&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Action&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;ICache&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; set = (o, s, obj) =&amp;gt; o.Set(s, obj);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;    &lt;span style="color: #2b91af"&gt;Expression&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Action&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;Memcached&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;, &lt;span style="color: blue"&gt;object&lt;/span&gt;&amp;gt;&amp;gt; insert = (i, s, obj) =&amp;gt; i.Put(s, obj);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;    &lt;span style="color: #2b91af"&gt;ICache&lt;/span&gt; cache = &lt;span style="color: blue"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Passthrough&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;ICache&lt;/span&gt;, &lt;span style="color: #2b91af"&gt;Memcached&lt;/span&gt;&amp;gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;                    .Create()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;                    .WithPassthrough(o =&amp;gt; o.Name, i =&amp;gt; i.InstanceName)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;                    .WithPassthrough(get, read)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;                    .WithPassthrough(set, insert)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;                    .As();&lt;/span&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;- or even in config:&lt;/p&gt;
&lt;div&gt;&lt;span style="font-size: 8pt"&gt;  &lt;span style="color: #2b91af"&gt;ICache&lt;/span&gt; cache = &lt;span style="color: #2b91af"&gt;Passthrough&lt;/span&gt;.GetConfigured&amp;lt;&lt;span style="color: #2b91af"&gt;ICache&lt;/span&gt;&amp;gt;();&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin: 0cm 0cm 10pt"&gt;...&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt; &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 8pt"&gt;passthrough&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 8pt"&gt;types&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 8pt"&gt;type&lt;/span&gt;&lt;span style="color: red; font-size: 8pt"&gt;name&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;=&lt;/span&gt;&lt;span style="font-size: 8pt"&gt;"&lt;span style="color: blue"&gt;PassthroughSample.Tests.Stubs.ICache, PassthroughSample.Tests&lt;/span&gt;"&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt;            &lt;/span&gt;&lt;span style="color: red; font-size: 8pt"&gt;passesThroughTo&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;=&lt;/span&gt;&lt;span style="font-size: 8pt"&gt;"&lt;span style="color: blue"&gt;PassthroughSample.Tests.Stubs.AppFabricCache, PassthroughSample.Tests&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 8pt"&gt;members&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt;          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 8pt"&gt;member&lt;/span&gt;&lt;span style="color: red; font-size: 8pt"&gt;name&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;=&lt;/span&gt;&lt;span style="font-size: 8pt"&gt;"&lt;span style="color: blue"&gt;Name&lt;/span&gt;"&lt;span style="color: red"&gt;passesThroughTo&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;RegionName&lt;/span&gt;"&lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt;          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 8pt"&gt;member&lt;/span&gt;&lt;span style="color: red; font-size: 8pt"&gt;name&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;=&lt;/span&gt;&lt;span style="font-size: 8pt"&gt;"&lt;span style="color: blue"&gt;Get&lt;/span&gt;"&lt;span style="color: red"&gt;passesThroughTo&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;Out&lt;/span&gt;"&lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt;          &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515; font-size: 8pt"&gt;member&lt;/span&gt;&lt;span style="color: red; font-size: 8pt"&gt;name&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;=&lt;/span&gt;&lt;span style="font-size: 8pt"&gt;"&lt;span style="color: blue"&gt;Set&lt;/span&gt;"&lt;span style="color: red"&gt;passesThroughTo&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;In&lt;/span&gt;"&lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 8pt"&gt;members&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="color: blue; font-size: 8pt"&gt;      &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515; font-size: 8pt"&gt;type&lt;/span&gt;&lt;span style="color: blue; font-size: 8pt"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;Possibly useful for injecting stubs for dependencies in tests, when your application code isn't using an IoC container. Possibly it also has an alternative implementation using .NET 4.0 dynamic objects, rather than the dynamic proxy.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;/div&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/139802.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2010/05/13/passthrough-objects--duck-typing.aspx</guid>
            <pubDate>Thu, 13 May 2010 18:51:43 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/139802.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2010/05/13/passthrough-objects--duck-typing.aspx#feedback</comments>
            <slash:comments>12</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/139802.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Code Gallery Reshuffle</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/11/26/code-gallery-reshuffle.aspx</link>
            <description>&lt;p style="text-align: center;"&gt;&lt;span style="font-size: 10pt;"&gt;[Source: &lt;a href="http://geekswithblogs.net/EltonStoneman"&gt;http://geekswithblogs.net/EltonStoneman&lt;/a&gt;] &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;I've been posting code samples and walkthroughs on &lt;a href="http://www.tinyurl.com/es-codegallery"&gt;MSDN Code Gallery&lt;/a&gt; for a while now – keeping them distinct from &lt;a href="http://www.tinyurl.com/es-codeplex"&gt;CodePlex&lt;/a&gt; which I use for fully-fledged projects and tools. CodePlex uses TFS for source control, but the Code Gallery only lets you post up individual files, so until now I've been creating releases as ZIP files containing the source.&lt;/p&gt;
&lt;p&gt;Now I've centralised the source for all those samples in a public repository on github at &lt;a href="http://github.com/sixeyed/codegallery"&gt;sixeyed/codegallery&lt;/a&gt;. The clone URL is: git://github.com/sixeyed/codegallery.git. If you're new to git, the &lt;a href="http://nathanj.github.com/gitguide/tour.html"&gt;Illustrated Guide to Git on Windows&lt;/a&gt; is a good starting point.&lt;/p&gt;
&lt;p&gt;For future work, I'll continue posting the source ZIPs as resources on MSDN Code Gallery, but the master will be on github.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/136551.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/11/26/code-gallery-reshuffle.aspx</guid>
            <pubDate>Thu, 26 Nov 2009 02:16:37 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/136551.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/11/26/code-gallery-reshuffle.aspx#feedback</comments>
            <slash:comments>9</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/136551.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Processing Excel uploads with BizTalk and nServiceBus</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/11/21/processing-excel-uploads-with-biztalk-and-nservicebus.aspx</link>
            <description>&lt;p&gt; &lt;/p&gt;
&lt;p class="MsoNormal" align="center" style="margin: 0cm 0cm 10pt; text-align: center"&gt;&lt;font face="Calibri"&gt;&lt;span lang="EN-GB" style="font-size: 10pt"&gt;[Source: &lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;a href="http://geekswithblogs.net/EltonStoneman"&gt;&lt;span style="font-size: 10pt"&gt;&lt;font color="#800080"&gt;http://geekswithblogs.net/EltonStoneman&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;span lang="EN-GB" style="font-size: 10pt"&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Following on from the sample for &lt;/font&gt;&lt;a href="http://geekswithblogs.net/EltonStoneman/archive/2009/11/18/processing-an-excel-upload-with-nservicebus.aspx"&gt;&lt;font face="Calibri"&gt;processing Excel uploads with nServiceBus&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;, I have a comparable version using BizTalk on MSDN Code Gallery here: &lt;/font&gt;&lt;a href="http://code.msdn.microsoft.com/BTSAndNSBExcelUpload"&gt;&lt;font face="Calibri" color="#800080"&gt;BizTalk and nServiceBus Excel Upload&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;. The BizTalk (2006 R2) sample uses a FILE receive port with a simple pipeline component to disassemble the Excel file into separate messages. A SQL send port subscribes to the messages, and with an outbound map calls the AdventureWorks stored procedure to insert each product.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Processing Excel in BizTalk is nothing new, but I wanted to do a comparison against the nServiceBus example, and also see how BizTalk and nServiceBus could be integrated. My original thinking was that the trigger in the nServiceBus solution relies on a FileSystemWatcher, which is less reliable and less flexible than BizTalk’s FILE adapter. A hybrid solution could use the FILE adapter to receive and parse the upload, then send each row as an AddProduct message to MSMQ, which the nServiceBus handler subscribes to.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Running this on the same environment (a Windows Server 2003 VM running under VirtualBox in Ubuntu 9.04), the BizTalk solution processes the 3,500 row Excel file in 3 mins 10 seconds (compared to 4m 15s for the distributed NSB running with 5 threads), and the 12,000 row file in 11m 14s (compared to 14m 0s). I was surprised to find the BizTalk solution running more quickly, as the original NSB was using non-recoverable messaging, so all messages were in memory, while BizTalk had the latency of writing to the message box. &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Performance Comparison&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;This is not an intended to be a thorough benchmark of NSB and BizTalk – both sample projects are basic, untuned implementations, and the tests are on a single box rather than two or three. But for comparison, I ran the 3,500 row upload repeatedly under different configurations:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l2 level1 lfo1"&gt;&lt;span lang="EN-GB" style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri"&gt;1.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;NSB with distributor – host and distributor using 20 threads&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l2 level1 lfo1"&gt;&lt;span lang="EN-GB" style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri"&gt;2.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;NSB with distributor – host and distributor using 20 threads, recoverable messaging&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l2 level1 lfo1"&gt;&lt;span lang="EN-GB" style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri"&gt;3.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;NSB without distributor – host using 20 threads&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l2 level1 lfo1"&gt;&lt;span lang="EN-GB" style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri"&gt;4.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;NSB without distributor – host using 20 threads, recoverable messaging&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l2 level1 lfo1"&gt;&lt;span lang="EN-GB" style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri"&gt;5.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;BizTalk FILE receive and SQL send&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l2 level1 lfo1"&gt;&lt;span lang="EN-GB" style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri"&gt;6.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;NSB parsing Excel file, BizTalk subscribing to AddProduct messages – MSMQ receive using batches of 100&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="margin: 0cm 0cm 10pt 36pt; text-indent: -18pt; mso-list: l2 level1 lfo1"&gt;&lt;span lang="EN-GB" style="mso-fareast-font-family: Calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: Calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: Ignore"&gt;&lt;font face="Calibri"&gt;7.&lt;/font&gt;&lt;span style="font: 7pt 'Times New Roman'"&gt;       &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;BizTalk parsing Excel file, NSB without distributor subscribing to AddProduct messages – host using 20 threads&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Which gave these averaged results:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span style="mso-ansi-language: EN-US; mso-fareast-language: EN-US; mso-no-proof: yes"&gt;&lt;v:shapetype id="_x0000_t75" stroked="f" filled="f" path="m@4@5l@4@11@9@11@9@5xe" o:preferrelative="t" o:spt="75" coordsize="21600,21600"&gt;&lt;v:stroke joinstyle="miter"&gt;&lt;/v:stroke&gt;&lt;v:formulas&gt;&lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 1 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum 0 0 @1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @2 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @3 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @0 0 1"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @6 1 2"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelWidth"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @8 21600 0"&gt;&lt;/v:f&gt;&lt;v:f eqn="prod @7 21600 pixelHeight"&gt;&lt;/v:f&gt;&lt;v:f eqn="sum @10 21600 0"&gt;&lt;/v:f&gt;&lt;/v:formulas&gt;&lt;v:path o:connecttype="rect" gradientshapeok="t" o:extrusionok="f"&gt;&lt;/v:path&gt;&lt;o:lock aspectratio="t" v:ext="edit"&gt;&lt;/o:lock&gt;&lt;/v:shapetype&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;&lt;img height="282" width="456" alt="" src="/images/geekswithblogs_net/EltonStoneman/NSBBTSChart.PNG" /&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Boosting the number of threads dramatically improved the NSB performance, and removing the distributor halved the duration. I would expect that running the distributor on a separate node would yield similarly good results on each processing node. The hybrid BizTalk/NSB configurations were the slowest – to be expected, as you have the latency of the message box and the latency of MSMQ saving to disk. NSB configurations without recoverable messaging were only marginally slower than the recoverable version, which seems incorrect based on &lt;/font&gt;&lt;a href="http://www.udidahan.com/2008/05/21/nservicebus-performance/"&gt;&lt;font face="Calibri" color="#800080"&gt;Udi Dahan’s performance benchmark&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;, so I’ll need to look into that further.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;There’s plenty of scope for improving performance in both solutions. BizTalk can be endlessly tuned (the &lt;/font&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/aa475435(BTS.10).aspx"&gt;&lt;font face="Calibri"&gt;2004 guidelines&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt; still apply as a good starting point). By modifying the NSB solution to send the AddProduct messages in one opration and using 80 threads for the handler, duration fell to 25 seconds – 140 messages per second.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Integrating BizTalk and nServiceBus&lt;/font&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Despite having the worst performance, integrating BizTalk and nServiceBus is a viable option which may be very useful in some cases. It would allow you to leverage BizTalk’s adapter suite and mapping functionality to join LOB systems into an nServiceBus estate. Integration is actually very straightforward. By default NSB uses MSMQ, so to publish messages from BizTalk to an NSB subscriber just means configuring an MSMQ send port with the expected queue, and mapping your message to NSB format – which is an envelope containing one or messages:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;xml&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span style="font-size: 9pt; color: red; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;version&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;"&lt;span style="color: blue"&gt;1.0&lt;/span&gt;"&lt;span style="color: blue"&gt; ?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;Messages&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt; &lt;/span&gt;&lt;span style="font-size: 9pt; color: red; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;xmlns:xsi&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;=&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;"&lt;span style="color: blue"&gt;http://www.w3.org/2001/XMLSchema-instance&lt;/span&gt;"&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;xmlns:xsd&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;http://www.w3.org/2001/XMLSchema&lt;/span&gt;"&lt;span style="color: blue"&gt; &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;"&lt;span style="color: blue"&gt;http://tempuri.net/ExcelUpload.Messages&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;AddProduct&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;BatchId&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;7a80fed4-9d30-44fe-95b0-08218c5f328e&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;BatchId&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;RegistrationIndex&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;58&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;RegistrationIndex&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;RegistrationsInBatch&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;254&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;RegistrationsInBatch&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;BatchSourcePath&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;E:\ExcelUpload\1.0.0.0\Binaries\Drops\ProductUpload.xls&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;BatchSourcePath&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;OriginatorDestination&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;ExcelUpload.Client.InputQueue@WIN2003R2-VM&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;OriginatorDestination&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;Name&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;new product 58&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;Name&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;ProductNumber&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;xlu-np-58&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ProductNumber&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;SafetyStockLevel&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;100&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;SafetyStockLevel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;ReorderPoint&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;20&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ReorderPoint&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;StandardCost&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;10&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;StandardCost&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;ListPrice&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;15.5&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ListPrice&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;DaysToManufacture&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;60&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;DaysToManufacture&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;    &lt;/span&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;SellStartDate&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;2005-02-27T00:00:00.0000000&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;SellStartDate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;AddProduct&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: #a31515; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;Messages&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;The MSMQ adapter lets you specify Recoverable and Transactional flags, so your BizTalk-generated messages have the same durability options. When an NSB handler is listening at the queue, it processes the BizTalk messages in the same way as NSB messages.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Publishing NSB messages to BizTalk is trickier, as the Send and Publish methods from NSB check to see if there are any subscribers before they write to the queue (compare this to the &lt;/font&gt;&lt;a href="http://ayende.com/Blog/archive/2008/12/17/rhino-service-bus.aspx"&gt;&lt;font face="Calibri"&gt;Notify method in RhinoServiceBus&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;). If a BizTalk MSMQ receive port is the only handler, no subscribers will be registered with NSB and the message won’t be published. So you need to either call Send with a named queue (&lt;/font&gt;&lt;/span&gt;&lt;span style="font-size: 9pt; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-no-proof: yes"&gt;Bus.Send&amp;lt;&lt;span style="color: #2b91af"&gt;AddProduct&lt;/span&gt;&amp;gt;(&lt;span style="color: #a31515"&gt;"ExcelUpload.AddProductService.1.InputQueue"&lt;/span&gt;, m =&amp;gt;...)&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;, or send a subscription message from BizTalk to register a subscriber. In the the second option you’d need to specify the message type in the subscription:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;lt;?xml version="1.0" ?&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none"&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;lt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: firebrick; font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;string&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;gt;&lt;/span&gt;&lt;span style="font-size: 9pt; color: black; font-family: 'Courier New'; mso-ansi-language: EN-US; mso-bidi-font-weight: bold"&gt;ExcelUpload&lt;b&gt;.&lt;/b&gt;Messages.StartBatchUpload, ExcelUpload.Messages, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="font-size: 9pt; color: firebrick; font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;string&lt;/span&gt;&lt;span style="font-size: 9pt; color: blue; font-family: 'Courier New'; mso-ansi-language: EN-US"&gt;&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 0pt"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-GB"&gt;&lt;o:p&gt;&lt;font face="Calibri"&gt; &lt;/font&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Running the Sample&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;(If you haven’t seen &lt;/font&gt;&lt;a href="http://geekswithblogs.net/EltonStoneman/archive/2009/11/18/processing-an-excel-upload-with-nservicebus.aspx"&gt;&lt;font face="Calibri"&gt;the original NSB sample&lt;/font&gt;&lt;/a&gt;&lt;font face="Calibri"&gt;, have a read as it details the pre-requisites).&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;To run the BizTalk solution, download ExcelUpload.BizTalk.Binaries.zip, unzip it and:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l0 level1 lfo2"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Copy &lt;i style="mso-bidi-font-style: normal"&gt;ExcelUpload.PipelineComponents.dll&lt;/i&gt; to your pipeline components directory – e.g. &lt;i style="mso-bidi-font-style: normal"&gt;C:\Program Files\Microsoft BizTalk Server 2006\Pipeline Components&lt;/i&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l0 level1 lfo2"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;If you haven’t done so from the previous sample, run &lt;i style="mso-bidi-font-style: normal"&gt;uspInsertProduct.CREATE.sql&lt;/i&gt; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l0 level1 lfo2"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Run &lt;i style="mso-bidi-font-style: normal"&gt;uspInsertProduct.CREATESYNONYM.sql&lt;/i&gt; &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l0 level1 lfo2"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Import the MSI into BizTalk&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l0 level1 lfo2"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Run the MSI&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l0 level1 lfo2"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Start send port SendInsertProduct.SQL (you’ll need to change the connection details)&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 36pt; text-indent: -18pt; mso-list: l0 level1 lfo2"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Enable receive location ReceiveStartUpload.FILE.XLS (monitors c:\drops\ExcelUpload)&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="margin: 0cm 0cm 10pt 36pt; text-indent: -18pt; mso-list: l0 level1 lfo2"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Drop an Excel file&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;As before, you’ll need to clear down the database between runs if you drop the same file repeatedly.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;If you want to run the hybrid solutions, you should use the binaries in the new download rather than the original, as these run without a distributor. Run &lt;i style="mso-bidi-font-style: normal"&gt;start.cmd&lt;/i&gt; and there are three windows – Client (the file watcher), Host (the StartBatchUpload handler) and AddProductService (this is the AddProduct handler). &lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;To run configuration 6 – NSB parsing the file and BizTalk handling the AddProduct messages:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Run start.cmd&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Kill the AddProductService console&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Disable receive location ReceiveStartUpload.FILE.XLS&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Enable receive location ReceiveAddProduct.MSMQ&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Unenlist send port SendAddProduct.MSMQ&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Start send port SendInsertProduct.SQL&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="margin: 0cm 0cm 10pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Drop an Excel file&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;To run configuration 7 – BizTalk parsing the file and NSB handling the AddProduct messages:&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpFirst" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Run start.cmd&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Kill the Host and Client consoles&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Enable receive location ReceiveStartUpload.FILE.XLS&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Disable receive location ReceiveAddProduct.MSMQ&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Start send port SendAddProduct.MSMQ&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpMiddle" style="margin: 0cm 0cm 0pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Unenlist send port SendInsertProduct.SQL&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="margin: 0cm 0cm 10pt 38.25pt; text-indent: -18pt; mso-add-space: auto; mso-list: l1 level1 lfo3"&gt;&lt;span lang="EN-GB" style="font-family: Symbol; mso-fareast-font-family: Symbol; mso-bidi-font-family: Symbol"&gt;&lt;span style="mso-list: Ignore"&gt;·&lt;span style="font: 7pt 'Times New Roman'"&gt;         &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Drop an Excel file&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;Source Code&lt;o:p&gt;&lt;/o:p&gt;&lt;/font&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin: 0cm 0cm 10pt"&gt;&lt;span lang="EN-GB"&gt;&lt;font face="Calibri"&gt;The source and referenced assemblies are in &lt;i style="mso-bidi-font-style: normal"&gt;ExcelUpload.BizTalk.Source.zip&lt;/i&gt;. There is a VS 2008 solution for the nServiceBus components, and a VS 2005 solution for the BizTalk components.&lt;/font&gt;&lt;/span&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/136449.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/11/21/processing-excel-uploads-with-biztalk-and-nservicebus.aspx</guid>
            <pubDate>Sat, 21 Nov 2009 01:57:56 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/136449.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/11/21/processing-excel-uploads-with-biztalk-and-nservicebus.aspx#feedback</comments>
            <slash:comments>47</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/136449.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Processing an Excel upload with nServiceBus</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/11/18/processing-an-excel-upload-with-nservicebus.aspx</link>
            <description>&lt;p&gt; &lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
&lt;meta name="ProgId" content="Word.Document" /&gt;
&lt;meta name="Generator" content="Microsoft Word 12" /&gt;
&lt;meta name="Originator" content="Microsoft Word 12" /&gt;
&lt;link rel="File-List" href="file:///C:\DOCUME~1\ELTON~1.STO\LOCALS~1\Temp\msohtmlclip1\01\clip_filelist.xml" /&gt;
&lt;link rel="Edit-Time-Data" href="file:///C:\DOCUME~1\ELTON~1.STO\LOCALS~1\Temp\msohtmlclip1\01\clip_editdata.mso" /&gt;&lt;!--[if !mso]&gt;
&lt;style&gt;
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
&lt;/style&gt;
&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;o:OfficeDocumentSettings&gt;
&lt;o:RelyOnVML /&gt;
&lt;o:AllowPNG /&gt;
&lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;link rel="themeData" href="file:///C:\DOCUME~1\ELTON~1.STO\LOCALS~1\Temp\msohtmlclip1\01\clip_themedata.thmx" /&gt;
&lt;link rel="colorSchemeMapping" href="file:///C:\DOCUME~1\ELTON~1.STO\LOCALS~1\Temp\msohtmlclip1\01\clip_colorschememapping.xml" /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:WordDocument&gt;
&lt;w:View&gt;Normal&lt;/w:View&gt;
&lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
&lt;w:TrackMoves&gt;false&lt;/w:TrackMoves&gt;
&lt;w:TrackFormatting /&gt;
&lt;w:DoNotShowRevisions /&gt;
&lt;w:DoNotPrintRevisions /&gt;
&lt;w:DoNotShowComments /&gt;
&lt;w:DoNotShowInsertionsAndDeletions /&gt;
&lt;w:DoNotShowPropertyChanges /&gt;
&lt;w:PunctuationKerning /&gt;
&lt;w:ValidateAgainstSchemas /&gt;
&lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
&lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
&lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
&lt;w:DoNotPromoteQF /&gt;
&lt;w:LidThemeOther&gt;EN-GB&lt;/w:LidThemeOther&gt;
&lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
&lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
&lt;w:Compatibility&gt;
&lt;w:BreakWrappedTables /&gt;
&lt;w:SnapToGridInCell /&gt;
&lt;w:WrapTextWithPunct /&gt;
&lt;w:UseAsianBreakRules /&gt;
&lt;w:DontGrowAutofit /&gt;
&lt;w:SplitPgBreakAndParaMark /&gt;
&lt;w:DontVertAlignCellWithSp /&gt;
&lt;w:DontBreakConstrainedForcedTables /&gt;
&lt;w:DontVertAlignInTxbx /&gt;
&lt;w:Word11KerningPairs /&gt;
&lt;w:CachedColBalance /&gt;
&lt;w:UseFELayout /&gt;
&lt;/w:Compatibility&gt;
&lt;w:DoNotOptimizeForBrowser /&gt;
&lt;m:mathPr&gt;
&lt;m:mathFont m:val="Cambria Math" /&gt;
&lt;m:brkBin m:val="before" /&gt;
&lt;m:brkBinSub m:val="&amp;#45;-" /&gt;
&lt;m:smallFrac m:val="off" /&gt;
&lt;m:dispDef /&gt;
&lt;m:lMargin m:val="0" /&gt;
&lt;m:rMargin m:val="0" /&gt;
&lt;m:defJc m:val="centerGroup" /&gt;
&lt;m:wrapIndent m:val="1440" /&gt;
&lt;m:intLim m:val="subSup" /&gt;
&lt;m:naryLim m:val="undOvr" /&gt;
&lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267"&gt;
&lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal" /&gt;
&lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 1" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 2" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 3" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 4" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 5" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 6" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 7" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 8" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 9" /&gt;
&lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /&gt;
&lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title" /&gt;
&lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /&gt;
&lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /&gt;
&lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong" /&gt;
&lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /&gt;
&lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /&gt;
&lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /&gt;
&lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title" /&gt;
&lt;w:LsdException Locked="false" Priority="37" Name="Bibliography" /&gt;
&lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /&gt;
&lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style type="text/css"&gt;&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:Wingdings;
	panose-1:5 0 0 0 0 0 0 0 0 0;
	mso-font-charset:2;
	mso-generic-font-family:auto;
	mso-font-pitch:variable;
	mso-font-signature:0 268435456 0 0 -2147483648 0;}
@font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-priority:1;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:10.0pt;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
a:link, span.MsoHyperlink
	{mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-unhide:no;
	color:blue;
	mso-themecolor:hyperlink;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-noshow:yes;
	mso-style-priority:99;
	color:purple;
	mso-themecolor:followedhyperlink;
	text-decoration:underline;
	text-underline:single;}
p.MsoListParagraph, li.MsoListParagraph, div.MsoListParagraph
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:10.0pt;
	margin-left:36.0pt;
	mso-add-space:auto;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpFirst, li.MsoListParagraphCxSpFirst, div.MsoListParagraphCxSpFirst
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:36.0pt;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpMiddle, li.MsoListParagraphCxSpMiddle, div.MsoListParagraphCxSpMiddle
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:0cm;
	margin-left:36.0pt;
	margin-bottom:.0001pt;
	mso-add-space:auto;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
p.MsoListParagraphCxSpLast, li.MsoListParagraphCxSpLast, div.MsoListParagraphCxSpLast
	{mso-style-priority:34;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-type:export-only;
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:10.0pt;
	margin-left:36.0pt;
	mso-add-space:auto;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-bidi-font-size:10.0pt;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;
	mso-header-margin:36.0pt;
	mso-footer-margin:36.0pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
 /* List Definitions */
 @list l0
	{mso-list-id:1664165705;
	mso-list-type:hybrid;
	mso-list-template-ids:-1453919300 67698689 67698691 67698693 67698689 67698691 67698693 67698689 67698691 67698693;}
@list l0:level1
	{mso-level-number-format:bullet;
	mso-level-text:;
	mso-level-tab-stop:none;
	mso-level-number-position:left;
	text-indent:-18.0pt;
	font-family:Symbol;}
ol
	{margin-bottom:0cm;}
ul
	{margin-bottom:0cm;}
--&gt;&lt;/style&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
mso-pagination:widow-orphan;
font-size:11.0pt;
mso-bidi-font-size:10.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;
&lt;p align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-size: 10pt;"&gt;[Source: &lt;/span&gt;&lt;a href="../../../../EltonStoneman"&gt;&lt;span style="font-size: 10pt;"&gt;http://geekswithblogs.net/EltonStoneman&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: 10pt;"&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;We’ve had a couple of projects recently with similar requirements to process an Excel file as a batch upload of data. One was a BizTalk project where the &lt;a href="http://www.fpoint.com/biztalk/default.aspx"&gt;FarPoint Spread pipeline component&lt;/a&gt; was a good fit; the other was a Web app where we put together a custom parser based on the open-source &lt;a href="http://www.codeplex.com/ExcelDataReader"&gt;ExcelDataReader&lt;/a&gt;. The custom solution was appropriate for the expected size of upload files, but wouldn’t scale well to deal with large files quickly, so I wanted to look at a distributed alternative using &lt;a href="http://www.nservicebus.com/"&gt;nServiceBus&lt;/a&gt;. My sample implementation is on MSDN Code Gallery here: &lt;a href="http://code.msdn.microsoft.com/NSBExcelUpload"&gt;nServiceBus Excel Upload&lt;/a&gt;. I’ll look at a comparative BizTalk solution in a future post.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;If you haven’t come across nServiceBus, it’s a queue-based messaging framework which is inherently asynchronous. “Scalability and reliability are in its DNA”, and it has some impressive case studies. Using nServiceBus you can set up a simple publish-subscribe architecture between nodes, or a load-balanced architecture with a central distributor. In the distributed version, the upload sample looks like this:&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;img height="259" width="400" alt="" src="/images/geekswithblogs_net/EltonStoneman/ExcelNSB.png" /&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style=""&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:formulas&gt;   &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;   &lt;v:f eqn="sum @0 1 0"&gt;   &lt;v:f eqn="sum 0 0 @1"&gt;   &lt;v:f eqn="prod @2 1 2"&gt;   &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;   &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @0 0 1"&gt;   &lt;v:f eqn="prod @6 1 2"&gt;   &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;   &lt;v:f eqn="sum @8 21600 0"&gt;   &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @10 21600 0"&gt;  &lt;/v:f&gt;  &lt;v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"&gt;  &lt;o:lock v:ext="edit" aspectratio="t"&gt; &lt;/o:lock&gt;&lt;v:shape id="Picture_x0020_2" o:spid="_x0000_i1025" type="#_x0000_t75" alt="ExcelNSB.png" style="width: 330pt; height: 213.75pt; visibility: visible;"&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\ELTON~1.STO\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.png" o:title="ExcelNSB"&gt; &lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;/v:path&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:formulas&gt;&lt;/v:stroke&gt;&lt;/v:shapetype&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;(Note that the diagram represents the bus as a separate entity, in reality it’s distributed among the queues of all the nodes. The diagram also omits the distributor).&lt;/p&gt;
&lt;p class="MsoNormal"&gt;In nServiceBus, services are requested by publishing messages onto the bus. Requests are fulfilled by a handler which subscribes to a type of message. The Excel upload sample takes a workbook which contains a set of products and uploads them to the AdventureWorks database. There are three types of message:&lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;!--[endif]--&gt;&lt;b style=""&gt;StartBatchUpload&lt;/b&gt; – published when a file has been received and is ready to be processed; subscriber does some basic validation on the Excel data structure, and then for each row in the worksheet publishes an AddProduct message;&lt;/li&gt;
    &lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol;"&gt;&lt;span style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=""&gt;AddProduct&lt;/b&gt; – subscriber maps the product defined in the message to a stored procedure call which inserts the new product. When the last product in the batch is reached, sends a BatchStatusChanged message to the original publisher of the StartBatchUpload message;&lt;/li&gt;
    &lt;li&gt;&lt;!--[if !supportLists]--&gt;&lt;span style="font-family: Symbol;"&gt;&lt;span style=""&gt;&lt;span style="font-family: &amp;quot;Times New Roman&amp;quot;; font-style: normal; font-variant: normal; font-weight: normal; font-size: 7pt; line-height: normal; font-size-adjust: none; font-stretch: normal;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;b style=""&gt;BatchStatusChanged&lt;/b&gt; – logs the status change and renames the Excel upload file.&lt;/li&gt;
&lt;/ul&gt;
&lt;p class="MsoNormal"&gt;This is a basic example, more validation would be expected, but the workflow is representative. Parsing the Excel file is done quickly, allowing for any number of nodes to participate in the resource-intensive work of creating the products. Using a single host with 5 threads, an Excel file with 3,500 rows takes just over 4 minutes to process on a dev laptop. That’s 13 messages per second which is nothing special, but this is on a single host which is also running the distributor and SQL Server. The processing host has a flat memory profile (consistently around 40Mb) and runs at less than 20% CPU. The distributor takes around 15% CPU, and MSMQ another 15%.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;For a much larger upload – 12,000 rows – the processing and memory profile is the same, and the upload takes around 14 minutes (~14 messages per second) on the same infrastructure.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;i style=""&gt;Running the Sample&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Access to a SQL Server instance with the &lt;a href="http://msftdbprodsamples.codeplex.com/"&gt;AdventureWorks sample database&lt;/a&gt; installed is a pre-requisite. You’ll need to add the new stored procedure with &lt;i style=""&gt;uspInsertProduct.CREATE.sql&lt;/i&gt;. The connection string used by the host is specified in &lt;i style=""&gt;ExcelUpload.Host.exe.config&lt;/i&gt; (defaults to unnamed local instance).&lt;/p&gt;
&lt;p class="MsoNormal"&gt;You’ll need MSMQ running on all nodes. Queues are specified in configuration and are created by nServiceBus if they don’t exist – an exception is the storage queue for the distributor which needs to be manually created, this PowerShell snippet will do it:&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;      &lt;/span&gt;[Reflection.Assembly]::LoadWithPartialName("System.Messaging")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;      &lt;/span&gt;[System.Messaging.MessageQueue]::Create(".\Private$\distributorStorage", $true)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Unzip the file &lt;i style=""&gt;ExcelUpload.Binaries.zip&lt;/i&gt;. You’ll have a batch file – &lt;i style=""&gt;start.cmd&lt;/i&gt; – and five subdirectories – Client, Host, Distributor, SampleFiles and Drops. Run &lt;i style=""&gt;start.cmd&lt;/i&gt;, check the console screens for errors, then copy one of the Excel files from SampleFiles to Drops. You should see activity in the host, client and distributor console screens, and new rows being added to the [Production].[Product] table.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;If you drop the same file twice, the unique key on Products will be violated, so the upload will error. On a fresh install there are under 1000 products, so this resets the table to the default state:&lt;/p&gt;
&lt;p class="MsoNormal" style="text-indent: 36pt;"&gt;&lt;span lang="EN-US" style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;delete&lt;/span&gt;&lt;span lang="EN-US" style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt; [Production]&lt;span style="color: gray;"&gt;.&lt;/span&gt;[Product] &lt;span style="color: blue;"&gt;where&lt;/span&gt; ProductID &lt;span style="color: gray;"&gt;&amp;gt;&lt;/span&gt; 999&lt;span style="color: gray;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;i style=""&gt;Implementation Details&lt;/i&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;The sample uses the release version of nServiceBus – &lt;a href="http://garr.dl.sourceforge.net/project/nservicebus/nservicebus/Version%201.9%20RTM/NServiceBus_version_1.9_RTM_Core_Binaries.zip"&gt;1.9&lt;/a&gt; – as the distributor was broken in the 2.0 beta at the time of writing.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;The two console apps run the “client” (which monitors a configured file location for an Excel drop, and publishes the StartBatchUpload message), and the “host” (which subscribes to StartBatchUpload and publishes AddProduct and BatchStatusChanged messages). Both use &lt;a href="http://codebetter.com/blogs/dru.sellers/archive/2009/01/11/topshelf.aspx"&gt;Topshelf&lt;/a&gt; so they can run as a console, or can be installed as a Windows service (e.g. &lt;i style=""&gt;ExcelUpload.Client.exe /install&lt;/i&gt;).&lt;/p&gt;
&lt;p class="MsoNormal"&gt;If you want to run several hosts on the same machine, they will need to use different queues. Copy the whole of the Host directory, and modify &lt;i style=""&gt;ExcelUpload.Host.exe.config&lt;/i&gt; to specify a unique queue name:&lt;/p&gt;
&lt;p class="MsoNormal" style="text-indent: 36pt;"&gt;&lt;span lang="EN-US" style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: red;"&gt;InputQueue&lt;/span&gt;&lt;span lang="EN-US" style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;; color: blue;"&gt;=&lt;/span&gt;&lt;span lang="EN-US" style="font-size: 9pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;"&lt;span style="color: blue;"&gt;ExcelUpload.Service.1.InputQueue&lt;/span&gt;"&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Then run &lt;i style=""&gt;ExcelUpload.Host.exe&lt;/i&gt; from all the copied locations, and you’ll see the console hosts sharing the message processing when a file is dropped.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;




 &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/136390.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/11/18/processing-an-excel-upload-with-nservicebus.aspx</guid>
            <pubDate>Wed, 18 Nov 2009 09:46:13 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/136390.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/11/18/processing-an-excel-upload-with-nservicebus.aspx#feedback</comments>
            <slash:comments>52</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/136390.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Duck Typing with Castle</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/10/21/duck-typing-with-castle.aspx</link>
            <description>&lt;link rel="File-List" href="file:///C:\DOCUME~1\STONEM~1\LOCALS~1\Temp\msohtmlclip1\01\clip_filelist.xml" /&gt;
&lt;link rel="Edit-Time-Data" href="file:///C:\DOCUME~1\STONEM~1\LOCALS~1\Temp\msohtmlclip1\01\clip_editdata.mso" /&gt;&lt;!--[if !mso]&gt;
&lt;style&gt;
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
&lt;/style&gt;
&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;o:OfficeDocumentSettings&gt;
&lt;o:RelyOnVML /&gt;
&lt;o:AllowPNG /&gt;
&lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;link rel="themeData" href="file:///C:\DOCUME~1\STONEM~1\LOCALS~1\Temp\msohtmlclip1\01\clip_themedata.thmx" /&gt;
&lt;link rel="colorSchemeMapping" href="file:///C:\DOCUME~1\STONEM~1\LOCALS~1\Temp\msohtmlclip1\01\clip_colorschememapping.xml" /&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:WordDocument&gt;
&lt;w:View&gt;Normal&lt;/w:View&gt;
&lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
&lt;w:TrackMoves&gt;false&lt;/w:TrackMoves&gt;
&lt;w:TrackFormatting /&gt;
&lt;w:PunctuationKerning /&gt;
&lt;w:ValidateAgainstSchemas /&gt;
&lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
&lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
&lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
&lt;w:DoNotPromoteQF /&gt;
&lt;w:LidThemeOther&gt;EN-GB&lt;/w:LidThemeOther&gt;
&lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
&lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
&lt;w:Compatibility&gt;
&lt;w:BreakWrappedTables /&gt;
&lt;w:SnapToGridInCell /&gt;
&lt;w:WrapTextWithPunct /&gt;
&lt;w:UseAsianBreakRules /&gt;
&lt;w:DontGrowAutofit /&gt;
&lt;w:SplitPgBreakAndParaMark /&gt;
&lt;w:DontVertAlignCellWithSp /&gt;
&lt;w:DontBreakConstrainedForcedTables /&gt;
&lt;w:DontVertAlignInTxbx /&gt;
&lt;w:Word11KerningPairs /&gt;
&lt;w:CachedColBalance /&gt;
&lt;w:UseFELayout /&gt;
&lt;/w:Compatibility&gt;
&lt;w:DoNotOptimizeForBrowser /&gt;
&lt;m:mathPr&gt;
&lt;m:mathFont m:val="Cambria Math" /&gt;
&lt;m:brkBin m:val="before" /&gt;
&lt;m:brkBinSub m:val="&amp;#45;-" /&gt;
&lt;m:smallFrac m:val="off" /&gt;
&lt;m:dispDef /&gt;
&lt;m:lMargin m:val="0" /&gt;
&lt;m:rMargin m:val="0" /&gt;
&lt;m:defJc m:val="centerGroup" /&gt;
&lt;m:wrapIndent m:val="1440" /&gt;
&lt;m:intLim m:val="subSup" /&gt;
&lt;m:naryLim m:val="undOvr" /&gt;
&lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
&lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
DefSemiHidden="true" DefQFormat="false" DefPriority="99"
LatentStyleCount="267"&gt;
&lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Normal" /&gt;
&lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="heading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8" /&gt;
&lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 1" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 2" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 3" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 4" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 5" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 6" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 7" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 8" /&gt;
&lt;w:LsdException Locked="false" Priority="39" Name="toc 9" /&gt;
&lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption" /&gt;
&lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Title" /&gt;
&lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font" /&gt;
&lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtitle" /&gt;
&lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Strong" /&gt;
&lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
UnhideWhenUsed="false" Name="Table Grid" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text" /&gt;
&lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="No Spacing" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision" /&gt;
&lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="List Paragraph" /&gt;
&lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Quote" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 1" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 2" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 3" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 4" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 5" /&gt;
&lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
UnhideWhenUsed="false" Name="Light List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
UnhideWhenUsed="false" Name="Light Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium List 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
UnhideWhenUsed="false" Name="Dark List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Shading Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful List Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
UnhideWhenUsed="false" Name="Colorful Grid Accent 6" /&gt;
&lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis" /&gt;
&lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Intense Reference" /&gt;
&lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
UnhideWhenUsed="false" QFormat="true" Name="Book Title" /&gt;
&lt;w:LsdException Locked="false" Priority="37" Name="Bibliography" /&gt;
&lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading" /&gt;
&lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style type="text/css"&gt;&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:roman;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-priority:1;
	mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0cm;
	margin-right:0cm;
	margin-bottom:10.0pt;
	margin-left:0cm;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	mso-bidi-font-size:10.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
a:link, span.MsoHyperlink
	{mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-unhide:no;
	color:blue;
	mso-themecolor:hyperlink;
	text-decoration:underline;
	text-underline:single;}
a:visited, span.MsoHyperlinkFollowed
	{mso-style-noshow:yes;
	mso-style-priority:99;
	color:purple;
	mso-themecolor:followedhyperlink;
	text-decoration:underline;
	text-underline:single;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-bidi-font-size:10.0pt;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;}
@page Section1
	{size:612.0pt 792.0pt;
	margin:72.0pt 72.0pt 72.0pt 72.0pt;
	mso-header-margin:36.0pt;
	mso-footer-margin:36.0pt;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;&lt;/style&gt;&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
/* Style Definitions */
table.MsoNormalTable
{mso-style-name:"Table Normal";
mso-tstyle-rowband-size:0;
mso-tstyle-colband-size:0;
mso-style-noshow:yes;
mso-style-priority:99;
mso-style-qformat:yes;
mso-style-parent:"";
mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
mso-para-margin-top:0cm;
mso-para-margin-right:0cm;
mso-para-margin-bottom:10.0pt;
mso-para-margin-left:0cm;
mso-pagination:widow-orphan;
font-size:11.0pt;
font-family:"Calibri","sans-serif";
mso-ascii-font-family:Calibri;
mso-ascii-theme-font:minor-latin;
mso-hansi-font-family:Calibri;
mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;
&lt;p align="center" class="MsoNormal" style="text-align: center;"&gt;&lt;span style="font-size: 10pt;"&gt;[Source: &lt;/span&gt;&lt;a href="../../../../EltonStoneman"&gt;&lt;span style="font-size: 10pt;"&gt;http://geekswithblogs.net/EltonStoneman&lt;/span&gt;&lt;/a&gt;&lt;span style="font-size: 10pt;"&gt;]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;a href="http://www.deftflux.net/blog/page/Duck-Typing-Project.aspx"&gt;David Meyer&lt;/a&gt; has a neat duck typing library for .NET which I’ve been looking at as I had a requirement to treat objects of various types in the same way. They all expose a “Value” property, but don’t implement an interface.&lt;/p&gt;
&lt;p class="MsoNormal"&gt;The library does more than I needed so I put together a quick duck typing implementation which just lets me treat an instance of an object which tacitly implements an interface, as a true implementation of the interface. In this example I can access &lt;strong style=""&gt;BespokeDateTime &lt;/strong&gt;and &lt;strong style=""&gt;BespokeInt&lt;/strong&gt; as &lt;strong style=""&gt;IHasValue&lt;/strong&gt;:&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;img height="251" width="450" alt="" src="/images/geekswithblogs_net/EltonStoneman/duck1.PNG" /&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style=""&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" o:spt="75" o:preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;  &lt;v:stroke joinstyle="miter"&gt;  &lt;v:formulas&gt;   &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;   &lt;v:f eqn="sum @0 1 0"&gt;   &lt;v:f eqn="sum 0 0 @1"&gt;   &lt;v:f eqn="prod @2 1 2"&gt;   &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;   &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @0 0 1"&gt;   &lt;v:f eqn="prod @6 1 2"&gt;   &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;   &lt;v:f eqn="sum @8 21600 0"&gt;   &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;   &lt;v:f eqn="sum @10 21600 0"&gt;  &lt;/v:f&gt;  &lt;v:path o:extrusionok="f" gradientshapeok="t" o:connecttype="rect"&gt;  &lt;o:lock v:ext="edit" aspectratio="t"&gt; &lt;/o:lock&gt;&lt;v:shape id="_x0000_i1026" type="#_x0000_t75" style="width: 333.75pt; height: 183.75pt; visibility: visible;"&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\STONEM~1\LOCALS~1\Temp\msohtmlclip1\01\clip_image001.png" o:title=""&gt; &lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;/v:path&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:f&gt;&lt;/v:formulas&gt;&lt;/v:stroke&gt;&lt;/v:shapetype&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Using &lt;a href="http://www.castleproject.org/dynamicproxy/index.html"&gt;Castle’s Dynamic Proxy&lt;/a&gt;, this is simple to do – just requiring you to generate an interface proxy with a custom interceptor. The interceptor invokes the interface method on the real object, so you effectively wrap an instance in an interface it doesn’t explicitly implement:&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;BespokeDateTime&lt;/span&gt; bespoke = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BespokeDateTime&lt;/span&gt;(&lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;DateTime&lt;/span&gt;(2000, 1, 1));&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;IHasValue&lt;/span&gt; duck = &lt;span style="color: rgb(43, 145, 175);"&gt;DuckType&lt;/span&gt;.As&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;IHasValue&lt;/span&gt;&amp;gt;(bespoke);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Console&lt;/span&gt;.WriteLine(duck.Value);&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;- or using an object extension to hide the implementation:&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;bespoke.As&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;IHasValue&lt;/span&gt;&amp;gt;().Value;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;Iterating over collections is much cleaner with duck typing – if I have a collection that contains both &lt;strong style=""&gt;BespokeDateTime&lt;/strong&gt; and &lt;strong style=""&gt;BespokeInt&lt;/strong&gt; objects, to get all their values I can use:&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue;"&gt;object&lt;/span&gt; obj &lt;span style="color: blue;"&gt;in&lt;/span&gt; GetObjects())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Assert&lt;/span&gt;.IsNotNull(&lt;span style="color: rgb(43, 145, 175);"&gt;DuckType&lt;/span&gt;.As&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;IHasValue&lt;/span&gt;&amp;gt;(obj).Value);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;- compared to casting each object:&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color: blue;"&gt;object&lt;/span&gt; obj &lt;span style="color: blue;"&gt;in&lt;/span&gt; GetObjects())&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;BespokeDateTime&lt;/span&gt; bespokeDateTime = obj &lt;span style="color: blue;"&gt;as&lt;/span&gt; &lt;span style="color: rgb(43, 145, 175);"&gt;BespokeDateTime&lt;/span&gt;;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (bespokeDateTime != &lt;span style="color: blue;"&gt;null&lt;/span&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Assert&lt;/span&gt;.IsNotNull(bespokeDateTime.Value);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;&lt;span style="color: blue;"&gt;else&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;BespokeInt&lt;/span&gt; bespokeInt = (&lt;span style="color: rgb(43, 145, 175);"&gt;BespokeInt&lt;/span&gt;) obj;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;            &lt;/span&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Assert&lt;/span&gt;.IsNotNull(bespokeInt.Value);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;        &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="font-size: 10pt; font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;Use with caution over large collections, as there is a noticeable performance hit in using the duck type. Over 500,000 items the duck-typed code takes 40-50 times as long as the casting code, averaging 8 seconds to 0.2 seconds, with duck-typing by extension taking marginally longer again:&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;o:p&gt;&lt;img height="77" width="373" alt="" src="/images/geekswithblogs_net/EltonStoneman/duck2.PNG" /&gt;&lt;br /&gt;
&lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;span style=""&gt;&lt;v:shape id="Picture_x0020_1" o:spid="_x0000_i1025" type="#_x0000_t75" style="width: 276pt; height: 56.25pt; visibility: visible;"&gt;  &lt;v:imagedata src="file:///C:\DOCUME~1\STONEM~1\LOCALS~1\Temp\msohtmlclip1\01\clip_image002.png" o:title=""&gt; &lt;/v:imagedata&gt;&lt;/v:shape&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;The full code (all 34 lines – including validation that the type to duck does tacitly implement the interface) is on MSDN Code Gallery here: &lt;a href="http://code.msdn.microsoft.com/DuckTypingWithCastle"&gt;Duck Typing with Castle&lt;/a&gt;.&lt;/p&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/135617.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/10/21/duck-typing-with-castle.aspx</guid>
            <pubDate>Wed, 21 Oct 2009 01:59:24 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/135617.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/10/21/duck-typing-with-castle.aspx#feedback</comments>
            <slash:comments>8</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/135617.aspx</wfw:commentRss>
        </item>
        <item>
            <title>WCF Personalization Provider for ASP.NET</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/09/15/wcf-personalization-provider-for-asp.net.aspx</link>
            <description>&lt;p style="TEXT-ALIGN: center"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;[Source: &lt;a href="http://geekswithblogs.net/EltonStoneman"&gt;http://geekswithblogs.net/EltonStoneman&lt;/a&gt;] &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The ASP.NET Web Part framework uses a plug-in framework for loading and saving personalization data to a persistent source. Out of the box, a SQL Server data source is provided (via the &lt;strong&gt;aspnet_regsql&lt;/strong&gt; tool), along with a SQL personalization provider – specified in the &lt;em&gt;system.web&lt;/em&gt; configuration section: &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;webParts&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;enableExport&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;true&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;personalization&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;defaultProvider&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;SqlPersonalizationProvider&lt;/span&gt; "&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;providers&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;SqlPersonalizationProvider&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;System.Web.UI.WebControls.WebParts.SqlPersonalizationProvider&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;connectionStringName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;local&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;applicationName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WcfPersonalizationSample&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;It's painless to set up and gets you running Web Part-enabled sites quickly. But if your Web servers and database servers are separated by a physical boundary with app servers in between, you can't use the SQL provider directly from the ASP.NET application and will need to write a custom personalization provider. &lt;/p&gt;
&lt;p&gt;Exposing the existing SQL personalization store through a custom WCF provider is a straightforward option – so your app server hosts a WCF service which itself uses the SQL personalization provider, and the Web server uses the WCF service through the custom provider. Although the implementation is fairly trivial, there are a couple of issues to work around: &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;strong&gt;PersonalizationProvider&lt;/strong&gt; is an abstract class which requires you to implement methods with &lt;strong&gt;out&lt;/strong&gt; and &lt;strong&gt;ref&lt;/strong&gt; parameters. You'll need to write methods with different signatures to work over WCF; &lt;/li&gt;
    &lt;li&gt;&lt;strong&gt;SqlPersonalizationProvider&lt;/strong&gt; has methods for loading personalization data as byte arrays, which are useful for the WCF service. To access them you'll need another custom provider which inherits from SqlPersonalizationProvider, as the underlying methods are &lt;em&gt;protected&lt;/em&gt;. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I've worked this through as a sample on MSDN Code Gallery: &lt;a href="http://code.msdn.microsoft.com/WCFPersonalization"&gt;WCF Personalization Provider Sample&lt;/a&gt;. &lt;/p&gt;
&lt;p&gt;To use it, the WCF service host needs to be configured to use the custom provider which wraps the SQL store, and a connection string entry for the data store: &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;connectionStrings&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;strong&gt;local&lt;/strong&gt;&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;connectionString&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;Data Source=.;Initial Catalog=WcfPersonalizationSample;Integrated Security=True&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;providerName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;System.Data.SqlClient&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;connectionStrings&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;system.web&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;webParts&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;enableExport&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;true&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;personalization&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;defaultProvider&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;PersonalizationServiceProvider&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;providers&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;PersonalizationServiceProvider&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;strong&gt;WcfPersonalizationProvider&lt;/strong&gt;.&lt;strong&gt;PersonalizationServiceProvider&lt;/strong&gt;&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;connectionStringName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;strong&gt;local&lt;/strong&gt;&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;applicationName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WcfPersonalizationSample&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;providers&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;personalization&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;webParts&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;...&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;(Note that this is using ASP.NET functionality in the WCF service, but you do not need to set the WCF service up for ASP.NET compatibility mode.) &lt;/p&gt;
&lt;p&gt;The Web site need to be configured to use the custom provider which accesses the WCF service, and a service client entry for the WCF service: &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;webParts&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;enableExport&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;true&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;personalization&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;defaultProvider&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WcfPersonalizationProvider&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;providers&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;add&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WcfPersonalizationProvider&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;type&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;strong&gt;WcfPersonalizationSample.ServiceClient.WcfPersonalizationProvider&lt;/strong&gt;&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;applicationName&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;WcfPersonalizationSample&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;providers&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;personalization&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;webParts&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;... &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;client&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;endpoint&lt;/span&gt;&lt;span style="COLOR: blue"&gt; &lt;/span&gt;&lt;span style="COLOR: red"&gt;address&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;http://localhost/PersonalizationService.svc&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;binding&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;basicHttpBinding&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;contract&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&lt;strong&gt;PersonalizationService.IPersonalizationService&lt;/strong&gt;&lt;/span&gt;" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&lt;/span&gt;&lt;span style="COLOR: red"&gt;name&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;BasicHttpBinding_IPersonalizationService&lt;/span&gt;"&lt;span style="COLOR: blue"&gt; /&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 10pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="COLOR: #a31515"&gt;client&lt;/span&gt;&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;Both providers need to specify the same &lt;em&gt;applicationName&lt;/em&gt; value, and your Web Part personalization, for shared and user scopes, will work without the Web servers accessing the database. &lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/134831.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/09/15/wcf-personalization-provider-for-asp.net.aspx</guid>
            <pubDate>Tue, 15 Sep 2009 13:49:24 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/134831.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/09/15/wcf-personalization-provider-for-asp.net.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/134831.aspx</wfw:commentRss>
        </item>
        <item>
            <title>FluentHtmlTextWriter</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/09/10/fluenthtmltextwriter.aspx</link>
            <description>&lt;p style="TEXT-ALIGN: center"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;[Source: &lt;a href="http://geekswithblogs.net/EltonStoneman"&gt;http://geekswithblogs.net/EltonStoneman&lt;/a&gt;] &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Keeping up the&lt;font style="BACKGROUND-COLOR: #ffffff"&gt; &lt;/font&gt;&lt;a href="http://geekswithblogs.net/EltonStoneman/Admin/EditPosts.aspx?catid=10643"&gt;fluent &lt;/a&gt;work, I've put together a fluent interface which wraps the framework &lt;strong&gt;HtmlTextWriter&lt;/strong&gt;. For ASP.NET MVC, this makes generating HTML in extension methods to &lt;strong&gt;HtmlHelper&lt;/strong&gt; safer than &lt;em&gt;string.Format()&lt;/em&gt; and more readable than &lt;strong&gt;HtmlTextWriter&lt;/strong&gt;: &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; Image(&lt;span style="COLOR: blue"&gt;this&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;HtmlHelper&lt;/span&gt; helper, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; imageRelativeUrl, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; altText) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;{ &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;FluentHtmlTextWriter&lt;/span&gt;.Begin() &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WriteTag(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterTag&lt;/span&gt;.Img) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Src, GetImageUrl(imageRelativeUrl)) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Alt, altText) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.End(); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;}&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;The equivalent using &lt;strong&gt;HtmlTextWriter&lt;/strong&gt; is: &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: blue"&gt;static&lt;/span&gt; &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; Image(&lt;span style="COLOR: blue"&gt;this&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;HtmlHelper&lt;/span&gt; helper, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; imageRelativeUrl, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; altText) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;{ &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt; htmlBuilder = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;StringBuilder&lt;/span&gt;(); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriter&lt;/span&gt; writer = &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;HtmlTextWriter&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;StringWriter&lt;/span&gt;(htmlBuilder)); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;writer.AddAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Src, GetImageUrl(imageRelativeUrl)); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;writer.AddAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Alt, altText); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;writer.RenderBeginTag(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterTag&lt;/span&gt;.Img); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;writer.RenderEndTag(); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;writer.Flush(); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;return&lt;/span&gt; htmlBuilder.ToString(); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;}&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;Unlike the framework writer, you're not constrained to specify attributes in any particular order, and tags which aren't nested can be written with a single &lt;em&gt;WriteTag()&lt;/em&gt;, rather than &lt;em&gt;BeginTag()&lt;/em&gt; and &lt;em&gt;EndTag()&lt;/em&gt; calls. The writer copes with multi-level tag hierarchies - this sample builds a &lt;a href="http://users.tpg.com.au/j_birch/plugins/superfish/"&gt;Superfish&lt;/a&gt; CSS menu: &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: #2b91af"&gt;FluentHtmlTextWriter&lt;/span&gt; writer = &lt;span style="COLOR: #2b91af"&gt;FluentHtmlTextWriter&lt;/span&gt;.Begin(); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;writer.BeginTag(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterTag&lt;/span&gt;.Ul) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Id, &lt;span style="COLOR: #a31515"&gt;"menu.Name"&lt;/span&gt;) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Class, &lt;span style="COLOR: #a31515"&gt;"sf-menu sf-vertical"&lt;/span&gt;); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.BeginTag(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterTag&lt;/span&gt;.Li) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.BeginTag(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterTag&lt;/span&gt;.A) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Class, &lt;span style="COLOR: #a31515"&gt;"sf-with-ul"&lt;/span&gt;) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Href, &lt;span style="COLOR: #a31515"&gt;"#"&lt;/span&gt;) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithValue(&lt;span style="COLOR: #a31515"&gt;"Link 1"&lt;/span&gt;) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WriteTag(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterTag&lt;/span&gt;.Span) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Class, &lt;span style="COLOR: #a31515"&gt;"sf-sub-indicator"&lt;/span&gt;) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithValue(&lt;span style="COLOR: #a31515"&gt;"&amp;amp;#187;"&lt;/span&gt;) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.EndTag() &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.EndTag() &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.EndTag(); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt; &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; html = writer.End(); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="COLOR: #a31515"&gt;"&amp;lt;ul id=\"menu.Name\" class=\"sf-menu sf-vertical\"&amp;gt;\r\n\t&amp;lt;li&amp;gt;&amp;lt;a class=\"sf-with-ul\" href=\"#\"&amp;gt;Link 1&amp;lt;span class=\"sf-sub-indicator\"&amp;gt;&amp;amp;#187;&amp;lt;/span&amp;gt;&amp;lt;/a&amp;gt;&amp;lt;/li&amp;gt;\r\n&amp;lt;/ul&amp;gt;"&lt;/span&gt;, &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;html);&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;HtmlTextWriter&lt;/strong&gt; equivalent is unthinkable. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://ondevelopment.blogspot.com/"&gt;Patrik Hägne&lt;/a&gt; has an alternative &lt;a href="http://ondevelopment.blogspot.com/2009/01/htmltextwriter-fluent-interface.html"&gt;fluent HtmlTextWriter&lt;/a&gt; implementation, which is nicely put together, but I wanted slightly different functionality. Firstly I wanted to get the HTML string from the writer directly, without needing to instantiate a &lt;strong&gt;StringBuilder&lt;/strong&gt; and &lt;strong&gt;StringWriter&lt;/strong&gt;. Secondly I wanted minimal new code – Patrik uses a separate class to manage writing attributes, and has specific functions for known tag types. Thirdly, I didn't really like Patrik's syntax, with the need to specify the tag type when you write an end tag – and when tags aren't nested, I wanted to write them in a single unit: &lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt; html = &lt;span style="COLOR: #2b91af"&gt;FluentHtmlTextWriter&lt;/span&gt;.Begin() &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WriteTag(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterTag&lt;/span&gt;.Span) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithAttribute(&lt;span style="COLOR: #2b91af"&gt;HtmlTextWriterAttribute&lt;/span&gt;.Id, &lt;span style="COLOR: #a31515"&gt;"id_span"&lt;/span&gt;) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.WithValue(&lt;span style="COLOR: #a31515"&gt;"contents_span"&lt;/span&gt;) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;.End(); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="FONT-SIZE: 9pt; FONT-FAMILY: Courier New"&gt;&lt;span style="COLOR: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(&lt;span style="COLOR: #a31515"&gt;"&amp;lt;span id=\"id_span\"&amp;gt;contents_span&amp;lt;/span&amp;gt;"&lt;/span&gt;, html);&lt;/span&gt; &lt;/p&gt;
&lt;p&gt;My version is on MSDN Code Gallery here: &lt;a href="http://code.msdn.microsoft.com/FluentHtmlTextWriter"&gt;FluentHtmlTextWriter&lt;/a&gt;. It works by building up a list of actions when you start writing a tag, and flushing them in the correct order to an internal &lt;strong&gt;HtmlTextWriter&lt;/strong&gt; when you start writing the next tag. When you call &lt;em&gt;End()&lt;/em&gt; it flushes the internal writer and outputs its contents. An alternative constructor lets you write directly to an output stream, in which case you can &lt;em&gt;Flush()&lt;/em&gt; the writer and don't need to call &lt;em&gt;End()&lt;/em&gt;. &lt;/p&gt;
&lt;p&gt;The current implementation only deals with basic tag, attribute and style functionality, and doesn't include optional HTML encoding overloads. It's only 75 lines of code, and extending it should be trivial. &lt;/p&gt;
&lt;p&gt;There is a negligible performance hit in using &lt;strong&gt;FluentHtmlTextWriter&lt;/strong&gt; – running the image tag generation code above 20,000 times on my dev machine, the fluent version takes between 0.01and 0.02 seconds longer than the framework version (on average 0.07 seconds compared to 0.05). &lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/134758.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/09/10/fluenthtmltextwriter.aspx</guid>
            <pubDate>Thu, 10 Sep 2009 18:32:28 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/134758.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/09/10/fluenthtmltextwriter.aspx#feedback</comments>
            <slash:comments>13</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/134758.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Fluent DAL Mapping</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/09/08/fluent-dal-mapping.aspx</link>
            <description>&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;If you spend some time using &lt;a href="http://fluentnhibernate.org/"&gt;Fluent NHibernate&lt;/a&gt;, you’ll want to use its neat style of mapping for all data access, even when you’re working against traditional DALs. I’ve put a sample up on MSDN Code Gallery for this scenario, using a fluent style of mapping between domain objects and data readers populated by stored procedure calls.&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;The interface is very similar to FNH, with a mapping class used for each domain entity – this is a simple mapping class:&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt; COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="FONT-SIZE: 10pt"&gt; &lt;span style="COLOR: blue"&gt;class&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;PostCodeMap&lt;/span&gt; : &lt;span style="COLOR: #2b91af"&gt;DataReaderMap&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;PostCode&lt;/span&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;{&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;    &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; PostCodeMap()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;    {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;        Map(x =&amp;gt; x.InwardCode, &lt;span style="COLOR: #a31515"&gt;"PS_IN"&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;        Map(x =&amp;gt; x.OutwardCode, &lt;span style="COLOR: #a31515"&gt;"PS_OUT"&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;    }&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;}&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;The string constants define the column names expected in the data reader, and the base class takes care of running the map. For more complex entities, &lt;strong&gt;DataReaderMap&lt;/strong&gt; also includes mapping via a conversion function:&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;    Map&amp;lt;&lt;span style="COLOR: blue"&gt;string&lt;/span&gt;, &lt;span style="COLOR: blue"&gt;bool&lt;/span&gt;&amp;gt;(x =&amp;gt; x.Activated, &lt;span style="COLOR: #a31515"&gt;"AccountActivated"&lt;/span&gt;, &lt;span style="COLOR: #2b91af"&gt;Legacy&lt;/span&gt;.FromBoolean);&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;- where the mapping specifies to and from types, and a delegate to invoke for the conversion (in this case, a method which converts a legacy string representation of a boolean – Y/N – to a bool).&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;For composite objects, the base map includes referencing, for cases where the child entity is loaded from the same data reader as the parent entity:&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;    References(x =&amp;gt; x.Address, &lt;span style="COLOR: blue"&gt;new&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;AddressMap&lt;/span&gt;());&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;Where the child entity is read from a separate data reader, then the composition needs to be done outside of the map in a repository or an assembler component. The &lt;strong&gt;Load&lt;/strong&gt; class isolates calling the stored procedure, so you get a fluent interface for populating domain objects, and collections of objects:&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;    &lt;span style="COLOR: blue"&gt;public&lt;/span&gt; &lt;span style="COLOR: #2b91af"&gt;User&lt;/span&gt; GetUser(&lt;span style="COLOR: #2b91af"&gt;Guid&lt;/span&gt; userId)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;    {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;        &lt;span style="COLOR: green"&gt;//populate basic details:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;        &lt;span style="COLOR: #2b91af"&gt;User&lt;/span&gt; user = &lt;span style="COLOR: #2b91af"&gt;Fluently&lt;/span&gt;.Load&amp;lt;&lt;span style="COLOR: #2b91af"&gt;User&lt;/span&gt;&amp;gt;().With&amp;lt;&lt;span style="COLOR: #2b91af"&gt;UserMap&lt;/span&gt;&amp;gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;                            .From&amp;lt;&lt;span style="COLOR: #2b91af"&gt;GetUser&lt;/span&gt;&amp;gt;(i =&amp;gt; i.UserId = userId,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;                                           x =&amp;gt; x.Execute());&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;        &lt;span style="COLOR: green"&gt;//add accounts:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;        user.Accounts = &lt;span style="COLOR: #2b91af"&gt;Fluently&lt;/span&gt;.Load&amp;lt;&lt;span style="COLOR: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="COLOR: #2b91af"&gt;Account&lt;/span&gt;&amp;gt;&amp;gt;().With&amp;lt;&lt;span style="COLOR: #2b91af"&gt;AccountMap&lt;/span&gt;&amp;gt;()&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;                                .From&amp;lt;&lt;span style="COLOR: #2b91af"&gt;GetUserAccounts&lt;/span&gt;&amp;gt;(i =&amp;gt; i.UserId = userId,&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;                                                       x =&amp;gt; x.Execute());&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="FONT-SIZE: 10pt"&gt;        &lt;span style="COLOR: blue"&gt;return&lt;/span&gt; user;&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;&lt;span style="FONT-SIZE: 10pt"&gt;    }&lt;/span&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;The &lt;em&gt;From()&lt;/em&gt; call specifies the type of stored procedure, an action to populate the object, in this case setting up the &lt;em&gt;UserId&lt;/em&gt; parameter, and a function to call which returns a data reader, in this case &lt;em&gt;Execute().&lt;/em&gt;&lt;/div&gt;
&lt;div style="MARGIN: 0cm 0cm 10pt"&gt;The full sample is on the gallery here: &lt;a href="http://code.msdn.microsoft.com/FluentDALMapping"&gt;Fluent DAL Mapping&lt;/a&gt; . It’s a simple task to extend the sample to load datasets, or to populate update procedure calls from entities. If your database is sufficiently conventional this could be extended to provide FNH-style auto-mapping, reflecting over entities and using conventions to map properties to column names.&lt;/div&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/134544.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/09/08/fluent-dal-mapping.aspx</guid>
            <pubDate>Tue, 08 Sep 2009 01:32:20 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/134544.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/09/08/fluent-dal-mapping.aspx#feedback</comments>
            <slash:comments>7</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/134544.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Using PowerShell in BizTalk Post-Processing Scripts</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/06/08/using-powershell-in-biztalk-post-processing-scripts.aspx</link>
            <description>&lt;p style="text-align: center;"&gt;&lt;span style="font-size: 10pt;"&gt;[Source: &lt;a href="http://geekswithblogs.net/EltonStoneman"&gt;http://geekswithblogs.net/EltonStoneman&lt;/a&gt;] &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Often in BizTalk deployments you need to do additional work after installation. Typically your full install process may need to: &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;Install BizTalk artifact assemblies to the GAC &lt;/li&gt;
    &lt;li&gt;Install application dependencies to the GAC &lt;/li&gt;
    &lt;li&gt;Register an application source name in the registry, for logging to the Event Log &lt;/li&gt;
    &lt;li&gt;Create FILE send or receive locations on the local filesystem &lt;/li&gt;
    &lt;li&gt;Add application store configuration settings to Enterprise Single Sign-On (SSO) &lt;/li&gt;
    &lt;li&gt;Add log4net configuration settings to BTSNTSvc.exe.config &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;You can achieve this with a single BizTalk installer by configuring resources and post-processing scripts, and exporting an MSI from the application. Various scripting languages are supported in BizTalk installations (batch files, VBScript etc.), except the most logical – PowerShell, which gives first-class support for the filesystem, the registry, XML files and .NET objects. You can still use PowerShell by including scripts as resources, and using a batch file as the post-processing script, which acts as a harness to call the PowerShell scripts. &lt;/p&gt;
&lt;p&gt;This walkthrough addresses all the points above. The completed BizTalk application is on MSDN Code Gallery here: &lt;a href="http://code.msdn.microsoft.com/BTSPowerShellSample"&gt;BizTalk PowerShell Deployment Sample&lt;/a&gt; – import and install the MSI to deploy with the PowerShell script, or browse the ZIP file to see the scripts and resources. &lt;/p&gt;
&lt;p&gt;&lt;em&gt;1. Install BizTalk artifact assemblies to the GAC &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;This is straightforward, set the resource option "Add to the global assembly cache on MSI file install" to true – this happens by default if you add a BizTalk Assembly resource in the Administration Console: &lt;/p&gt;
&lt;p&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/060809_2059_UsingPowerS1.png" alt="" /&gt; 	&lt;/p&gt;
&lt;p&gt;Using the command line though, this is not the default option so you need to explicitly set –Options:GacOnInstall in BTSTask: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;btstask AddResource&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-ApplicationName:PowerShellSample  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Type:BizTalkAssembly  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Options:GacOnInstall  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Source:PowerShellSample.Schemas.dll  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Destination:%BTAD_InstallDir%\PowerShellSample.Schemas.dll &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;em&gt;2. Install application dependencies to the GAC &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;As 1), except the resource type is System.BizTalk:Assembly (in BTSTask you can omit "System.BizTalk"). The command requires the same flag to add to the GAC on install: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;btstask AddResource  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-ApplicationName:PowerShellSample  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Type:Assembly  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Options:GacOnInstall  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Overwrite  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Source:.\Dependencies\SSOConfig.dll  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Destination:%BTAD_InstallDir%\Dependencies\SSOConfig.dll &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;In this case, I'm installing the SSOConfig assembly (from &lt;a href="http://ssoconfigtool.codeplex.com/"&gt;SSO Config Tool&lt;/a&gt;) which provides static .NET classes for accessing the SSO application configuration store. The Overwrite flag is set in case the resource already exists in another application. &lt;/p&gt;
&lt;p&gt;&lt;em&gt;3. Register an application source name in the registry, for logging to the Event Log &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;To log to the Application event log with your own source name, you need to add a registry key with the app name, and the name of the handler: &lt;/p&gt;
&lt;p&gt;HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PowerShell.Sample &lt;/p&gt;
&lt;p&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/060809_2059_UsingPowerS2.png" alt="" /&gt; 	&lt;/p&gt;
&lt;p&gt;In PowerShell, this is done in using the &lt;strong&gt;New-Item&lt;/strong&gt; cmdlet to create the key, and &lt;strong&gt;New-ItemProperty&lt;/strong&gt; to set the key value: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;New-Item -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PowerShellSample' -Force &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Eventlog\Application\PowerShellSample' -Name 'EventMessageFile' -PropertyType ExpandString -Value 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\EventLogMessages.dll' –Force &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;(HKLM: is a PowerShell drive mapped to HKEY_LOCAL_MACHINE, and the –Force flag overwrites existing values). &lt;/p&gt;
&lt;p&gt;To execute the PowerShell script on install, we need a batch file which BizTalk can run as a post-processing script. The batch file is very simple, just separating install and uninstall logic to individual PowerShell scripts, and redirecting script output to a log file: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;cd "%BTAD_InstallDir%\Deployment" &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;if "%BTAD_InstallMode%" == "Install" ( powershell ".\PowerShellSample.Install.ps1" &amp;gt;&amp;gt; PowerShellSample.Install.ps1.log ) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;if "%BTAD_InstallMode%" == "Uninstall" ( powershell ".\ PowerShellSample.Uninstall.ps1" &amp;gt;&amp;gt; PowerShellSample.Uninstall.ps1.log ) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;Both the CMD and PS1 files need to be added as resources to the BizTalk application. The PS1 files are of type BizTalk:File, and the CMD harness is of type BizTalk:PostProcessingScript: &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;btstask AddResource  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-ApplicationName:PowerShellSample  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Type:File  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Source:.\Deployment\PowerShellSample.Install.ps1  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Destination:%BTAD_InstallDir%\Deployment\PowerShellSample.Install.ps1 &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;btstask AddResource  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-ApplicationName:PowerShellSample  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Type:PostProcessingScript  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Source:.\Deployment\PowerShellSample.PostProcessing.cmd  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;-Destination:%BTAD_InstallDir%\Deployment\PowerShellSample.PostProcessing.cmd &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;em&gt;4. Create FILE send or receive locations on the local filesystem &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you need to create static file locations, the same &lt;strong&gt;New-Item&lt;/strong&gt; cmdlet is used with the filesystem provider. Specify the full path for the directory and any intermediate directories will be created if they don't exist. Use the –Force flag to suppress warnings if the directory already exists: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;New-Item –Path 'c:\receiveLocations\x\y\z' -ItemType Directory –Force &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Note that the resources in the BizTalk application are copies rather than references, so if you modify your PS1 files, you'll need to update the resource (in the Administration Console, select the resource and use &lt;em&gt;Modify... Refresh&lt;/em&gt;, or re-run the BTSTask command). &lt;/p&gt;
&lt;p&gt;&lt;em&gt;5. Add settings to Enterprise Single Sign-On (SSO) &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;If you're using SSO to store group-wide application config, you can create or export an XML file of the settings using &lt;a href="http://ssoconfigtool.codeplex.com/"&gt;SSO Config Tool&lt;/a&gt;. We add the .ssoconfig file as a File resource to the application, then in the install script use PowerShell to call a .NET method to import the settings using the SSOConfig.SSOApplication class. The SSOConfig assembly is a resource which has already been deployed to the GAC by this point in the installation: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;[Reflection.Assembly]::Load('SSOConfig, Version=1.1.0.0, Culture=neutral, PublicKeyToken=656a499478affdaf') &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;$configPath = [IO.Path]::Combine($env:BTAD_InstallDir, 'Deployment\PowerShellSample.ssoconfig') &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;$app = [SSOConfig.SSOApplication]::LoadFromXml($configPath) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;$app.SaveToSSO() &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;Note that the PowerShell script has access to all the &lt;a href="http://msdn.microsoft.com/en-us/library/aa559790.aspx"&gt;environment variables set by BizTalk&lt;/a&gt; on the install – accessed by prefixing $env: to the variable name, as we do here to get the installation directory from the installer ($env:BTAD_InstallDir). &lt;/p&gt;
&lt;p&gt;&lt;em&gt;6. Add settings to BTSNTSvc.exe.config &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;Modifying XML is straightforward in PowerShell. We want to configure an Event Log appender in the BizTalk service config file by adding the following XML: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;  &amp;lt;configSections&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    &amp;lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler, log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821" /&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;  &amp;lt;/configSections&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;  &amp;lt;log4net&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    &amp;lt;appender name="Sixeyed.CacheAdapter.EventLogAppender" type="log4net.Appender.EventLogAppender, log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821"&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;      &amp;lt;param name="LogName" value="Application"/&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;      &amp;lt;param name="ApplicationName" value="Sixeyed.CacheAdapter"/&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;      &amp;lt;layout type="log4net.Layout.PatternLayout"&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;        &amp;lt;conversionPattern value="%date [%thread] %logger %level - %message%newline" /&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;      &amp;lt;/layout&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    &amp;lt;/appender&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    &amp;lt;logger name="Sixeyed.CacheAdapter.Log"&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;      &amp;lt;level value="WARN" /&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;        &amp;lt;appender-ref ref="Sixeyed.CacheAdapter.EventLogAppender" /&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;      &amp;lt;/logger&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;  &amp;lt;/log4net&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;The &lt;strong&gt;Get-ItemProperty&lt;/strong&gt; cmdlet can read the BizTalk install path from the registry, then &lt;strong&gt;Get-Content&lt;/strong&gt; reads the file – casting it to XML for subsequent processing: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;$installPath = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0' -Name 'InstallPath' &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;$btsConfigPath = [IO.Path]::Combine($installPath.InstallPath, 'BTSNTSvc.exe.config') &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;$xml = [xml] (Get-Content $btsConfigPath) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;On a fresh install, the config file is quite bare and doesn't include a &amp;lt;configSections&amp;gt; element, so in that case we need to add both &amp;lt;configSections&amp;gt; and &amp;lt;log4net&amp;gt; nodes. We can't guarantee that other solutions haven't already modified the config file though, so &amp;lt;configSections&amp;gt; may exist, and &amp;lt;log4net&amp;gt; may also exist – in which case, we just need to add our specific appender and logger values (log4net allows you to define multiples of these in config, and we specify names which we can expect to be unique).  &lt;/p&gt;
&lt;p&gt;To achieve this, the script checks for each element first, creates it if it doesn't exist, then adds the specific settings: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;$configSections = $xml.SelectSingleNode('configuration/configSections') &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;if ($configSections -eq $null)  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    $configSections = $xml.CreateElement('configSections') &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    $firstChild = $xml.configuration.get_FirstChild() &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    $xml.configuration.InsertBefore($configSections, $firstChild) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;} &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;$log4netSection = $configSections.SelectSingleNode('section[@name="log4net"]') &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;if ($log4netSection -eq $null) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    $log4netSection = $xml.CreateElement('section') &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    $log4netSection.SetAttribute('name', 'log4net') &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    $log4netSection.SetAttribute('type', 'log4net.Config.Log4NetConfigurationSectionHandler, log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=1b44e1d426115821')     &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    $configSections.AppendChild($log4netSection ) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;} &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;... &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;Finally the updates are saved over the original file: &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;$xml.Save($btsConfigPath) &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Limitations &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The main limitation with any post-processing script, is that the target environment selected for the install is not available. If you have multiple bindings files, the environment selected at runtime is only alive for the duration of the MSI import – the install has no reference to it, and there's no record made in the management database (not that I can see, please correct me if there is). This means you can't switch your script based on environment (e.g. to use different SSO config settings for System Test and Production). If that's a serious restriction you may prefer to create different MSIs per-environment in your build process, each containing the correct bindings file and scripts. &lt;/p&gt;
&lt;p&gt;Specific to this approach, you need to have PowerShell installed on all the target machines, and configured to allow script execution (by default, &lt;a href="http://www.windowsecurity.com/articles/PowerShell-Security.html"&gt;scripts are not permitted to execute&lt;/a&gt;, as a security measure). Hopefully this is becoming the norm. Security also needs to be considered – the sample app writes to the registry and to SSO, so the installing context needs to have explicit permissions. The BizTalk installer runs under a separate security context from the installing user (by a trial-and-error process, this is &lt;strong&gt;NT AUTHORITY\ANONOYMOUS LOGON&lt;/strong&gt; in my Server 2003 VM), so if you're amending SSO you'll need to set your SSO Administrators group membership correctly. &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Benefits &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The completed PowerShell scripts should be straightforward to read and maintain. All the post-installation requirements are implemented using a single technology, and many of the functions are reusable and could easily be parameterised and moved to a central script. The script is easy to test outside of the installer runtime, either manually using a batch file as a test harness (which sets up the relevant environment variables and then calls the post-processing file), or worked into an automated unit test. &lt;/p&gt;
&lt;p&gt;The approach is not limited to BizTalk installations, so similar tasks for .NET deployments which are currently done with custom assemblies or Wix script can be isolated in the same way. With BizTalk and .NET installs using the same technology, you'll build up a library of high-quality, reusable PowerShell scripts.  &lt;/p&gt;
&lt;p&gt;I also like having the scripts deployed as part of the install, so in combination with the log files, you can see exactly what's been done to your environment and modify if necessary. &lt;/p&gt;
&lt;p&gt;&lt;em&gt;Extensions &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;With native cmdlets and &lt;a href="http://poshcode.org/"&gt;community scripts&lt;/a&gt;, together with WMI, XML and .NET code, you can achieve any desired functionality with PowerShell scripts, and have them rapidly developed and tested. So you can easily add code to update version numbers in config files, &lt;a href="http://weblogs.asp.net/adweigert/archive/2008/10/31/powershell-install-gac-gacutil-for-powershell.aspx"&gt;remove your assemblies from the GAC&lt;/a&gt; on uninstall, &lt;a href="http://www.leeholmes.com/blog/AccessingPerformanceCountersInPowerShell.aspx"&gt;access performance counters&lt;/a&gt; etc. And PowerShell scripts are just plain text so you can extract them into a T4 template and generate different scripts for different environments in your build process. &lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/132694.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/06/08/using-powershell-in-biztalk-post-processing-scripts.aspx</guid>
            <pubDate>Mon, 08 Jun 2009 14:58:18 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/132694.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/06/08/using-powershell-in-biztalk-post-processing-scripts.aspx#feedback</comments>
            <slash:comments>14</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/132694.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Managing Concurrency over Service Boundaries</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/04/15/managing-concurrency-over-service-boundaries.aspx</link>
            <description>&lt;p style="text-align: center;"&gt;&lt;span style="font-size: 10pt;"&gt;[Source: &lt;a href="http://geekswithblogs.net/EltonStoneman"&gt;http://geekswithblogs.net/EltonStoneman&lt;/a&gt;] &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Managing concurrency within an application boundary can be straightforward where you own the database schema and the application's data representation. By adding an incrementing lock sequence to tables and holding the current sequence in entity objects, you can implement optimistic locking at the database level without a significant performance hit. At the service level, the situation is more complicated. Even where the database schema can be extended, you wouldn't want the internals of concurrency management to be exposed in service contracts, so the lock sequence approach isn't suitable. &lt;/p&gt;
&lt;p&gt;An alternative pattern is to compute a data signature representing the retrieved state of an entity at the service level, and flow the signature alongside the entity in Get services. On Update calls, the original data signature is passed back and compared to the current signature of the data; if they differ then there's been a concurrency violation and the update fails. The signature can be passed as a SOAP header across the wire so it's not part of the contract and the optimistic locking strategy is transparent to consumers. &lt;/p&gt;
&lt;p&gt;The level of transparency will depend on the consumer, as it needs to retrieve the signature from the Get call, retain it, and pass it back on the Update call. In WCF the DataContract versioning mechanism can be used to extract the signature from the header and retain it in the &lt;em&gt;ExtensionData&lt;/em&gt; property of &lt;strong&gt;IExtensibleDataObject&lt;/strong&gt;. The contents of the &lt;em&gt;ExtensionData&lt;/em&gt; property are not directly accessible, so if the same &lt;strong&gt;DataContract&lt;/strong&gt; is used on the Get and the Update, and the signature management is done through WCF extension points, then concurrency control is transparent to users. &lt;/p&gt;
&lt;p&gt;I've worked through a WCF implementation for this pattern on MSDN Code Gallery here: &lt;a href="http://code.msdn.microsoft.com/WCFOptimisticLocking"&gt;Optimistic Locking over WCF&lt;/a&gt;. The sample uses a WCF behavior on the server side to compute a data signature (as a hash of the serializable object – generating a deterministic GUID from the XML string) and adds it to outgoing message headers for all services which return a &lt;strong&gt;DataContract&lt;/strong&gt; object. On the consumer side, a parallel behaviour extracts the data signature from the header and adds it to &lt;em&gt;ExtensionData&lt;/em&gt;, by appending it to the XML payload and using the standard &lt;strong&gt;DataContractSerializer&lt;/strong&gt; to extract it. &lt;/p&gt;
&lt;p&gt;The update service checks the data signature passed in the call with the current signature of the object and throws a known &lt;strong&gt;FaultException&lt;/strong&gt; if there's been a concurrency violation, which the WCF client can catch and react to: &lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/041509_2214_ManagingCon1.png" /&gt; 	&lt;/p&gt;
&lt;p&gt;&lt;em&gt;Sixeyed.OptimisticLockingSample &lt;/em&gt;&lt;/p&gt;
&lt;p&gt;The sample solution consists of four projects providing a SQL database for Customer entities, WCF Get and Update services, a WCF client and the ServiceModel library which contains the data signature behaviors. &lt;strong&gt;DataSignatureServiceBehavior&lt;/strong&gt; adds a dispatch message formatter to each service operation, which computes the hash for any &lt;strong&gt;DataContract&lt;/strong&gt; objects being returned, and adds it to the message headers. &lt;strong&gt;DataSignatureEndpointBehavior&lt;/strong&gt; on the client adds a client message formatter to each endpoint operation, which extracts the hash from incoming calls, stores it in &lt;em&gt;ExtensionData&lt;/em&gt; and adds it back to the header on outgoing calls.  &lt;/p&gt;
&lt;p&gt;Concurrency checking is done on the server side in the Update call, by comparing the given data signature to the signature from the current object state: &lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Guid&lt;/span&gt; dataSignature = &lt;span style="color: rgb(43, 145, 175);"&gt;DataSignature&lt;/span&gt;.Current; &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (dataSignature == &lt;span style="color: rgb(43, 145, 175);"&gt;Guid&lt;/span&gt;.Empty) &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt; 			&lt;span style="color: green;"&gt;//this is an update method, so no data signature to  &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt; 			&lt;span style="color: green;"&gt;//compare against is an exception: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt; 			&lt;span style="color: blue;"&gt;throw&lt;/span&gt; 			&lt;span style="color: blue;"&gt;new&lt;/span&gt; 			&lt;span style="color: rgb(43, 145, 175);"&gt;FaultException&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;NoDataSignature&lt;/span&gt;&amp;gt;(&lt;span style="color: blue;"&gt;new&lt;/span&gt; 			&lt;span style="color: rgb(43, 145, 175);"&gt;NoDataSignature&lt;/span&gt;()); &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;} &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;  &lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Customer&lt;/span&gt; currentState = CustomerEntityService.Load(customer); &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;Guid&lt;/span&gt; currentDataSignature = &lt;span style="color: rgb(43, 145, 175);"&gt;DataSignature&lt;/span&gt;.Sign(currentState); &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="color: green; font-family: Courier New; font-size: 10pt;"&gt;//if the data signatures match then update: &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="color: blue;"&gt;if&lt;/span&gt; (currentDataSignature == dataSignature) &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;    CustomerEntityService.Update(customer); &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;} &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="color: blue; font-family: Courier New; font-size: 10pt;"&gt;else &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt; 			&lt;span style="color: green;"&gt;//otherwise, throw concurrency violation exception: &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt; 			&lt;span style="color: blue;"&gt;throw&lt;/span&gt; 			&lt;span style="color: blue;"&gt;new&lt;/span&gt; 			&lt;span style="color: rgb(43, 145, 175);"&gt;FaultException&lt;/span&gt;&amp;lt;&lt;span style="color: rgb(43, 145, 175);"&gt;ConcurrencyViolation&lt;/span&gt;&amp;gt;(&lt;span style="color: blue;"&gt;new&lt;/span&gt; 			&lt;span style="color: rgb(43, 145, 175);"&gt;ConcurrencyViolation&lt;/span&gt;()); &lt;/span&gt;&lt;/p&gt;
&lt;p style="margin-left: 36pt;"&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;}&lt;/span&gt; 	&lt;/p&gt;
&lt;p&gt;A limitation of the sample is the use of &lt;strong&gt;IExtensibleDataObject&lt;/strong&gt; to store the data signature at the client side. Although this is fully functional and allows a completely generic solution, it relies on reflection to extract the data signature and add it to the message headers for the update call, which is &lt;a href="http://geekswithblogs.net/EltonStoneman/archive/2009/04/03/accessing-extended-data-from-iextensibledataobject.aspx"&gt;a brittle option.&lt;/a&gt; Where you have greater control over the client, you can use a custom solution which will be more suitable – e.g. creating and implementing an &lt;strong&gt;IDataSignedEntity&lt;/strong&gt; interface, or if consuming the services in BizTalk, by using context properties. &lt;/p&gt;
&lt;p&gt;  &lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/131239.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/04/15/managing-concurrency-over-service-boundaries.aspx</guid>
            <pubDate>Wed, 15 Apr 2009 22:15:04 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/131239.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/04/15/managing-concurrency-over-service-boundaries.aspx#feedback</comments>
            <slash:comments>8</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/131239.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
