<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>MSDN Code Gallery</title>
        <link>http://geekswithblogs.net/EltonStoneman/category/8867.aspx</link>
        <description>MSDN Code Gallery</description>
        <language>en-GB</language>
        <copyright>EltonStoneman</copyright>
        <managingEditor>elton.stoneman@gmail.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <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;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=135617"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=135617" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&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 07: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>1</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;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134831"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134831" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&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 19: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>
            <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;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134758"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134758" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&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>Fri, 11 Sep 2009 00: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>
            <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;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134544"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=134544" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&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 07: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>
            <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;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132694"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=132694" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&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 20: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>4</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;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131239"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131239" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&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>Thu, 16 Apr 2009 04: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>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/131239.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Making Logging Cheaper with Lambda Expressions</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/04/15/making-logging-cheaper-with-lambda-expressions.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 venerable &lt;a href="http://logging.apache.org/log4net/download.html"&gt;log4net library&lt;/a&gt; enables cheap instrumentation with configured logging levels, so logs are only written if the log call is on or above the active level. However, the evaluation of the log message always takes place, so there is some performance hit even if the log is not actually written. You can get over this by using delegates for the log message, which are only evaluated based on the active log level: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&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;void&lt;/span&gt; Log(&lt;span style="color: rgb(43, 145, 175);"&gt;LogLevel&lt;/span&gt; level, &lt;span style="color: rgb(43, 145, 175);"&gt;Func&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt; fMessage) &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 style="color: blue;"&gt;if&lt;/span&gt; (IsLogLevelEnabled(level)) &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;            LogInternal(level, fMessage.Invoke()); &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;Making the delegate call with a lambda expression makes the code easy to read, as well as giving a performance saving: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt; 			&lt;span style="color: rgb(43, 145, 175);"&gt;Logger&lt;/span&gt;.Log(&lt;span style="color: rgb(43, 145, 175);"&gt;LogLevel&lt;/span&gt;.Debug,  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;        () =&amp;gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(163, 21, 21);"&gt;"Time: {0}, Config setting: {1}"&lt;/span&gt;,  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt; 			&lt;span style="color: rgb(43, 145, 175);"&gt;DateTime&lt;/span&gt;.Now.TimeOfDay,  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt; 			&lt;span style="color: rgb(43, 145, 175);"&gt;ConfigurationManager&lt;/span&gt;.AppSettings[&lt;span style="color: rgb(163, 21, 21);"&gt;"configValue"&lt;/span&gt;]));&lt;/span&gt; 	&lt;/p&gt;
&lt;p&gt;For simple log messages, the saving may be minimal, but if the log involves walking the current stack to retrieve parameter values, it may be worth having. The sample above writes the current time and a configuration value to the log, if set to Debug. With the log level set to Warn, the log isn't written. Executing the call 1,000,000 times at Warn level consistently takes over 3.7 seconds if the logger call is made directly, and less than 0.08 seconds if the Lambda delegate is used: &lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/041509_2207_MakingLoggi1.png" /&gt; 	&lt;/p&gt;
&lt;p&gt;With a Warn call, the log is active and the direct and Lambda variants run 5,000 calls in 8.6 seconds, writing to a rolling log file appender: &lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/041509_2207_MakingLoggi2.png" /&gt; 	&lt;/p&gt;
&lt;p&gt;I've added the logger and test code to the MSDN Code Gallery sample: &lt;a href="http://code.msdn.microsoft.com/log4netLambdaSample"&gt;Lambda log4net Sample&lt;/a&gt;, if you're interested in checking it out.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131238"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=131238" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/131238.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/04/15/making-logging-cheaper-with-lambda-expressions.aspx</guid>
            <pubDate>Thu, 16 Apr 2009 04:08:28 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/131238.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/04/15/making-logging-cheaper-with-lambda-expressions.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/131238.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Alternative SOAP Transport for LoadGen</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/02/24/alternative-soap-transport-for-loadgen.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;Using &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=C8AF583F-7044-48DB-B7B9-969072DF1689&amp;amp;displaylang=en"&gt;LoadGen 2007&lt;/a&gt; to submit messages with a complex SOAP header, I had a strange issue with the standard SOAP transport. The SOAP transport has two parameters for wrapping the input file into a SOAP envelope: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;Parameters&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;URL&amp;gt;http://x/ESB.ItineraryServices.Response/ProcessItinerary.asmx&amp;lt;/URL&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;SOAPHeader&amp;gt;SOAPAction: "http://microsoft.practices.esb/Process/SubmitRequestResponse"&amp;lt;/SOAPHeader&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt; background-color: silver;"&gt;&amp;lt;SOAPPrefixEnv&amp;gt;&amp;amp;lt;?xml version=&amp;amp;quot;1.0&amp;amp;quot; …&amp;lt;/SOAPPrefixEnv&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&lt;span style="background-color: silver;"&gt;&amp;lt;SOAPPostfixEnv&amp;gt;&amp;amp;lt;/Root&amp;amp;gt;&amp;amp;lt;/SubmitRequestResponse&amp;amp;gt…&amp;lt;/SOAPPostfixEnv&amp;gt;&lt;/span&gt; 		&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;IsUseIntegratedAuth&amp;gt;False&amp;lt;/IsUseIntegratedAuth&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;LatencyFileName&amp;gt;&amp;lt;/LatencyFileName&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;ResponseMsgPath&amp;gt;&amp;lt;/ResponseMsgPath&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;DstEncoding&amp;gt;utf-8&amp;lt;/DstEncoding&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;/Parameters&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;- note the ellipses above are for brevity and are not in the actual LoadGen config file. &lt;/p&gt;
&lt;p&gt;When the transport gets called, it opens an HTTP request and sends the SOAP envelope by writing three sets of byte arrays to the request stream: the value of &lt;em&gt;SOAPEnvPrefix&lt;/em&gt;, the contents of the input file, then the value of &lt;em&gt;SOAPEnvPostfix&lt;/em&gt;. All the byte arrays are encoded to the value specified by &lt;em&gt;DstEncoding&lt;/em&gt;. When I used this configuration to send a message it was being rejected by the endpoint as a bad request. Trapping the request with Wireshark, it looked like this: &lt;/p&gt;
&lt;p&gt;&lt;img alt="" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/022409_1832_Alternative1.png" /&gt; 	&lt;/p&gt;
&lt;p&gt;It looks as though LoadGen has injected an ellipsis before each part of the message it built – the envelope prefix, the input file contents and the envelope postfix all start with an ellipsis in which is not in the original. The request is malformed and rejected by the service. &lt;/p&gt;
&lt;p&gt;Initially I thought this was something strange in how Wireshark was showing the results and wasn't actually part of the message, so I checked further and found that the XML escapes weren't set correctly. The SOAP header is an &lt;a href="http://www.codeplex.com/esb"&gt;ESB Guidance&lt;/a&gt; itinerary which contains escaped XML for CDATA sections – to enter it as the &lt;em&gt;SOAPEnvPrefix&lt;/em&gt; parameter meant escaping the escapes, so &lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;amp;lt;!CDATA[]&amp;amp;gt;&lt;/span&gt; becomes &lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;amp;amp;lt;!CDATA[]&amp;amp;amp;gt;&lt;/span&gt; in the parameter and is rendered correctly. But the issue remained, and so did the ellipses. Copying the full request into Web Service Studio produced the same result, but cutting out the ellipses meant it processed correctly. &lt;/p&gt;
&lt;p&gt;With time accumulating on what should have been a simple task, I checked out the SOAPTransport code and could see nothing that was causing this. Debugging the call didn't show any ellipsis characters being written, and modifying it to produce a single string of the header, body and footer before encoding made no difference. In the end I created a modified transport which takes a full SOAP envelope as the input file, doing away with the envelope parameters altogether.  &lt;/p&gt;
&lt;p&gt;This worked fine, didn't render any ellipses – although the code is very similar to LoadGen's SOAPTransport class – and was happily processed. It has the advantage that you can capture a full message with Wireshark, save it and use it in LoadGen without having to extract the header. It's on the MSDN Code Gallery here: &lt;a href="http://code.msdn.microsoft.com/SixeyedSamples"&gt;Sixeyed.Samples&lt;/a&gt; (Sixeyed.Samples.LoadGen.Transports.AlternativeSOAPTransport).  &lt;/p&gt;
&lt;p&gt;Configuration is very similar to the standard transport, just specify the assembly and remove the SOAP envelope parameters: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;Transport Name="SOAP"&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;  &amp;lt;Assembly&amp;gt;Sixeyed.Samples.dll/Sixeyed.Samples.LoadGen.Transports.AlternativeSOAPTransport&amp;lt;/Assembly&amp;gt;  &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;/Transport&amp;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;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;Parameters&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;URL&amp;gt;http://x/ESB.ItineraryServices.Response/ProcessItinerary.asmx&amp;lt;/URL&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;SOAPHeader&amp;gt;SOAPAction: "http://microsoft.practices.esb/Process/SubmitRequestResponse"&amp;lt;/SOAPHeader&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;IsUseIntegratedAuth&amp;gt;False&amp;lt;/IsUseIntegratedAuth&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;LatencyFileName&amp;gt;&amp;lt;/LatencyFileName&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;ResponseMsgPath&amp;gt;&amp;lt;/ResponseMsgPath&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;DstEncoding&amp;gt;utf-8&amp;lt;/DstEncoding&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 10pt;"&gt;&amp;lt;/Parameters&amp;gt; &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;  &lt;/p&gt;
&lt;p&gt;But I'm still puzzled about those ellipses from the standard SOAP transport.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129646"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=129646" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/129646.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/02/24/alternative-soap-transport-for-loadgen.aspx</guid>
            <pubDate>Wed, 25 Feb 2009 00:33:57 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/129646.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/02/24/alternative-soap-transport-for-loadgen.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/129646.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Generic WCF Error Handler for ESB Guidance</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2009/01/20/generic-wcf-error-handler-for-esb-guidance.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 management portal for ESB Guidance is an excellent tool which displays information on faults generated during the processing of messages through the ESB. It also exposes Web and WCF services for logging your own faults to the exception database, so you can record exceptions that occur in your own service providers and use the portal as a single view over the health of your SOA stack. &lt;/p&gt;
&lt;p&gt;The SubmitFault method of the ExceptionManagement service takes a FaultMessage object which must be correctly configured with Header and FaultException properties. It takes some trial-and-error to work out what needs populating – if any properties are missing or invalid, your fault won't be logged. I've put together a sample error handler on MSDN Code Gallery which populates a call correctly: &lt;a href="http://code.msdn.microsoft.com/ESBGErrorHandler"&gt;ESB Guidance Error Handler&lt;/a&gt;, which you can use as-is in your WCF services, or as a basis for your own handler. &lt;/p&gt;
&lt;p&gt;In the sample, the error handler is available to your service so you can manually log a fault for any exceptions that you catch, and you can also configure it as a service behaviour so it will log any uncaught exceptions in your WCF service. A sample service and client are provided for demonstration – set up the SampleService as a virtual directory and run SampleClient (you'll need the ESB Guidance Exception Management installed). &lt;/p&gt;
&lt;p&gt;To use the ServiceProviderErrorHandler add a config section in your web.config to specify how faults are logged: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;section&lt;/span&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&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;serviceProviderErrorHandlerConfiguration&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&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;ESBGuidanceErrorHandler.Configuration.ServiceProviderErrorHandlerConfiguration, ESBGuidanceErrorHandler&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;configSections&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;serviceProviderErrorHandlerConfiguration&lt;/span&gt;&lt;span style="color: blue;"&gt; 			&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: 9pt;"&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;exceptionHandlingUrl&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;http://localhost/ESB.ExceptionHandlingServices/ExceptionHandling.asmx&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&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: 9pt;"&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;bizTalkApplication&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;BizTalk Application 1&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&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: 9pt;"&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;faultCode&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;50054&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&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: 9pt;"&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;errorType&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;Service Provider exception&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&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: 9pt;"&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;failureCategory&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;0&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&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: 9pt;"&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;faultGeneratorName&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;ESBGuidanceErrorHandler&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;serviceProviderErrorHandlerConfiguration&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;This identifies the location of the ExceptionHandling service (the sample uses the SOAP entry point, but it's a simple change to use the WCF version as they have the same signature) and the descriptive text to categorise errors being logged, which will be shown in the portal. Note that the specified BizTalk Application must exist and the fault generator name is limited to 50 characters. Other values can contain any identifiers you like. &lt;/p&gt;
&lt;p&gt;With the config specified, it's a simple call to log a fault – passing the name of the service provider and the service, description and severity of the fault, and an exception: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: rgb(43, 145, 175);"&gt;ServiceProviderErrorHandler&lt;/span&gt;.SubmitFault(&lt;span style="color: rgb(163, 21, 21);"&gt;"ErroringService"&lt;/span&gt;, &lt;span style="color: rgb(163, 21, 21);"&gt;"LogHandledException"&lt;/span&gt;, &lt;span style="color: rgb(163, 21, 21);"&gt;"Caught exception"&lt;/span&gt;, &lt;span style="color: rgb(43, 145, 175);"&gt;FaultSeverity&lt;/span&gt;.Error, ex); &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;To register the ServiceProviderErrorHandler to catch any unhandled exceptions that occur just requires a behaviour extension in the WCF service configuration: &lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;system.serviceModel&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;services&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;service&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;ErroringService&lt;/span&gt;"&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;behaviorConfiguration&lt;/span&gt;&lt;span style="color: blue;"&gt;=&lt;/span&gt;"&lt;span style="color: blue;"&gt;defaultServiceBehavior&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;endpoint&lt;/span&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;IErroringService&lt;/span&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 style="color: blue;"&gt;/&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;service&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;services&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;behaviors&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;serviceBehaviors&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;behavior&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;defaultServiceBehavior&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;                    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;serviceMetadata&lt;/span&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;httpGetEnabled&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;                    &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;serviceDebug&lt;/span&gt;&lt;span style="color: blue;"&gt; 			&lt;/span&gt;&lt;span style="color: red;"&gt;includeExceptionDetailInFaults&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;                    &lt;em&gt;&amp;lt;&lt;/em&gt;&lt;/span&gt;&lt;em&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;serviceProviderBehavior&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;                &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;behavior&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;serviceBehaviors&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-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;behaviors&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-family: Courier New; font-size: 9pt;"&gt;&lt;em&gt;&lt;span style="color: blue;"&gt;        &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;extensions&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;em&gt;&lt;span style="color: blue;"&gt;            &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;behaviorExtensions&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;em&gt;&lt;span style="color: blue;"&gt;                &amp;lt;&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&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;serviceProviderBehavior&lt;/span&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;ESBGuidanceErrorHandler.Behaviors.ServiceProviderBehavior, ESBGuidanceErrorHandler, Version=1.0.0.0, Culture=neutral, PublicKeyToken=de4c0bb04730ca55&lt;/span&gt;"&lt;span style="color: blue;"&gt;/&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;em&gt;&lt;span style="color: blue;"&gt;            &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;behaviorExtensions&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;em&gt;&lt;span style="color: blue;"&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;extensions&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt; &lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="font-family: Courier New; font-size: 9pt;"&gt;&lt;span style="color: blue;"&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt; &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Add this to all your WCF service providers and any exceptions will be logged and can be shown, filtered and subscribed to in the normal way.&lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128808"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=128808" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/128808.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2009/01/20/generic-wcf-error-handler-for-esb-guidance.aspx</guid>
            <pubDate>Tue, 20 Jan 2009 14:43:29 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/128808.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2009/01/20/generic-wcf-error-handler-for-esb-guidance.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/128808.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ESB Guidance Demonstration: “TriathlonResults”</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2008/10/25/esb-guidance-demonstration-triathlonresults.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;At the SBUG meeting last week, my session on &lt;a href="http://sbug.org.uk/media/p/129.aspx"&gt;"ESB Guidance: A Real-World Implementation&lt;/a&gt;" was meant to end with a demonstration, but we ran out of time - and in any case what I'd intended to show was probably a bit ambitious, with plenty of this-is-bound-to-go-wrong points.  &lt;/p&gt;
&lt;p&gt;But I've spent some time making it more solid and the code is available now on MSDN Code Gallery: &lt;a href="http://code.msdn.microsoft.com/ESBTriathlonResults"&gt;&lt;strong&gt;ESB Guidance 1.0 Demonstration: TriathlonResults&lt;/strong&gt;&lt;/a&gt;, if you want to have a look. You'll need an environment with BizTalk 2006 R2 and ESB Guidance 1.0 set up to run it, but I'm looking at putting together a Webcast to give a walkthrough.&lt;span style="background-color: yellow;"&gt;&lt;strong&gt; 			&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Overview &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The demonstration involves a set of systems which each have custom integrations to a central system, and shows two SOA approaches for integrating them with BizTalk and ESB Guidance. The first approach is a partial migration, where the client systems are unchanged, but the central system picks up messages directed through ESBG. The second is a "full" SOA migration, where the clients are changed to integrate directly with ESBG. &lt;/p&gt;
&lt;p&gt;For the sake of an interesting demo, the systems are contrived to be unusual. They represent different systems for recording an athlete's time in a sector of a triathlon – each having a different UI and a different integration approach. The first sector - the swim - is recorded from a console app: &lt;/p&gt;
&lt;p&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/102508_0609_ESBGuidance1.png" alt="" /&gt; 	&lt;/p&gt;
&lt;p&gt; The second – the bike – from a WinForms app: &lt;/p&gt;
&lt;p&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/102508_0609_ESBGuidance2.png" alt="" /&gt; 	&lt;/p&gt;
&lt;p&gt;And the third – the run – from an Excel 2003 workbook with some VBA script: &lt;/p&gt;
&lt;p&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/102508_0609_ESBGuidance3.png" alt="" /&gt; 	&lt;/p&gt;
&lt;p&gt;The integrations add results to a central database, which has a particularly poor web front-end: &lt;/p&gt;
&lt;p&gt;&lt;img src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/102508_0609_ESBGuidance4.png" alt="" /&gt; 	&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Pre-requisites &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Windows Server 2003  with IIS &amp;amp; UDDI Services installed; SQL Server 2005; BizTalk Server 2006 R2; ESB Guidance 1.0.  &lt;/p&gt;
&lt;p&gt;The sample expects everything to live on &lt;em&gt;localhost&lt;/em&gt;, and uses a SQL Server login so you need to have mixed authentication and named pipes enabled in your SQL Server instance. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Installation &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Two steps after downloading the code – build and deploy the &lt;em&gt;TriathlonResults.Phase1&lt;/em&gt; solution (you'll need to modify the BizTalk projects to point to your own management database), then run the &lt;em&gt;Deploy.cmd&lt;/em&gt; script (it'll ask for the name of your SQL Server – just use "." for a local un-named instance).  &lt;/p&gt;
&lt;p&gt;This will create: &lt;/p&gt;
&lt;ul style="margin-left: 38pt;"&gt;
    &lt;li&gt;two SQL databases – &lt;em&gt;TriathlonResults&lt;/em&gt; and &lt;em&gt;TriathlonStaging&lt;/em&gt;; &lt;/li&gt;
    &lt;li&gt;a SQL login – &lt;em&gt;TriathlonResults&lt;/em&gt;; &lt;/li&gt;
    &lt;li&gt;a BizTalk application  - &lt;em&gt;TriathlonResults&lt;/em&gt;; &lt;/li&gt;
    &lt;li&gt;two IIS virtual directories – &lt;em&gt;TriathlonResults.Web&lt;/em&gt; and &lt;em&gt;TriathlonResults.Central&lt;/em&gt;.   &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;In the Shortcuts folder under the solution root you'll have links to the various client apps, and to the website which shows the full results from the central system. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Phase 0 &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is the starting point, with each system integrating to the central results service in a custom way: &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;Console app:&lt;/span&gt; receives user input and outputs as a delimited flat file; a central console app runs a FileSystemWatcher over the expected location, parses the flat file and inserts the record to the central database; &lt;/li&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;WinForms app:&lt;/span&gt; receives user input and sends the sector result as a Web service call to the central service, which inserts the record to the central database; &lt;/li&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;Excel workbook:&lt;/span&gt; receives user input and inserts the result as a record in a staging database; a trigger on the staging table retrieves the new record and inserts it to the central database. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To see this, run &lt;em&gt;SetupPhase0.cmd&lt;/em&gt; and input some results. Usage of the client apps should be fairly straightforward – choose Athlete id=1 and Race id=1 to use known reference data, and refresh the web page for the first race after each input. You should see the sector times displayed after you enter them. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Phase 1 &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is the first SOA approach, showing an option for partial migration. Here the central result-recording Web service has been exposed as a service through ESBG, and the clients all use the central service. The WinForms client has been changed to invoke the ESBG call directly, but the other systems are unchanged and a BizTalk app picks up their output and submits it to the ESB: &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;Console app:&lt;/span&gt; flat file output is now monitored by a BizTalk FILE Receive Location. The pipeline for the location parses the flat file into a known schema, and adds the itinerary details as context properties; &lt;/li&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;WinForms app:&lt;/span&gt; uses a typed Service Request class to submit messages to ESBG directly. This is a proxy class which deals with wrapping the message in an ESBG itinerary, and submitting it to the on-ramp; &lt;/li&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;Excel workbook:&lt;/span&gt; the trigger on the staging database is disabled and replaced with a SQL Receive Location which polls the staging table for unprocessed records. The pipeline adds itinerary details to the context; &lt;/li&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;TriathlonResults BizTalk app:&lt;/span&gt; for the FILE and SQL Receive Locations, the BizTalk app has custom orchestrations which map incoming messages to the contract for the Web service, and submit the request. The send port &lt;em&gt;DynamicRequestResponse&lt;/em&gt; subscribes to any pre-formed itinerary message, so this picks up the message from the WinForms app, which doesn't require any specific workflow. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To use, close down any client apps you have running, run &lt;em&gt;SetupPhase1.cmd&lt;/em&gt;, open the clients and input some results. The command clears down the results DB, so you should start with an empty results page on the website. As you use the clients you can confirm they're using ESBG by checking HAT. You'll probably also notice that the WinForms app responds more slowly when you submit a result. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Phase 2 &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This is a full SOA migration, where the consumers are aware of the mechanism for requesting services, unlike the Phase 1 approach where this was abstracted away from the legacy apps. All client apps are changed here to invoke the ESBG service request directly: &lt;/p&gt;
&lt;ul&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;Console app:&lt;/span&gt; now uses the typed Service Request used by the WinForms app to build the ESBG message and submit it. Flat file no longer generated; &lt;/li&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;WinForms app:&lt;/span&gt; unchanged from Phase 1; &lt;/li&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;Excel Workbook:&lt;/span&gt; the typed Service Request is registered as a COM-callable Type Library and referenced from the Workbook. The VBA instantiates, populates and submits the ESBG message. Staging database no longer used; &lt;/li&gt;
    &lt;li&gt;&lt;span style="text-decoration: underline;"&gt;TriathlonResults BizTalk app:&lt;/span&gt; the SQL and FILE receive locations are no longer used, all incoming messages are of the expected itinerary type and are all dealt with by the &lt;em&gt;DynamicRequestResponse&lt;/em&gt; port. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;To use, close down any client apps you have running, run &lt;em&gt;SetupPhase2.cmd&lt;/em&gt;, open the clients and input some results. Again, you should start with an empty results page on the website and can use HAT to confirm messages are going through BizTalk. You'll notice now that all the apps are responding more slowly when you submit a result. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Notes &lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The Phase 1 approach is a pragmatic one, realising some of the benefits expected in SOA at the cost of others. We have reuse of loosely-coupled services, a centralised discoverable service repository, and centralised message flow. We don't have a common communication mechanism and we haven't got away from bespoke formats and protocols. In some environments this may be as far as the migration goes, if service consumers can't be modified. It has the benefit of being transparent to consumers, but with bespoke mapping and configuration for each consumer it will have the largest custom codebase – taking more effort to develop and maintain. &lt;/p&gt;
&lt;p&gt;Phase 2 gives us the benefits of Phase 1, plus we are now using a single entry point to the ESB and consumers are submitting messages of known types which can be verified against the service contract schemas held in BizTalk. This particular implementation sees all the apps using a .NET component to abstract the work of creating the itinerary. This means consumers need no knowledge of BizTalk or ESB Guidance, but has the complication of distributing and maintaining that assembly. Consumers could use any approach to build their requests, provided they can understand XML and SOAP. &lt;/p&gt;&lt;p&gt;&lt;a href="http://www.pheedo.com/click.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=126102"&gt;&lt;img src="http://www.pheedo.com/img.phdo?x=6cda6ad746d942b9a1110d0715a4fa12&amp;u=126102" border="0"/&gt;&lt;/a&gt;&lt;/p&gt;&lt;iframe src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;PageID=31016&amp;amp;SiteID=1" width=1 height=1 Marginwidth=0 Marginheight=0 Hspace=0 Vspace=0 Frameborder=0 Scrolling=No&gt;
&lt;script language='javascript1.1' src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Browser=NETSCAPE4&amp;amp;NoCache=True&amp;PageID=31016&amp;amp;SiteID=1"&gt;&lt;/script&gt;
&lt;noscript&gt;&lt;a href="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Click&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" target="_blank"&gt;
&lt;img src="http://ads.geekswithblogs.net/a.aspx?ZoneID=5&amp;amp;Task=Get&amp;amp;Mode=HTML&amp;amp;SiteID=1&amp;amp;PageID=31016" width="1" height="1" border="0"  alt=""&gt;&lt;/a&gt;
&lt;/noscript&gt;
&lt;/iframe&gt;
&lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/126102.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>EltonStoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2008/10/25/esb-guidance-demonstration-triathlonresults.aspx</guid>
            <pubDate>Sat, 25 Oct 2008 12:10:16 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/126102.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2008/10/25/esb-guidance-demonstration-triathlonresults.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/126102.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>