<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>Elton Stoneman</title>
        <link>http://geekswithblogs.net/EltonStoneman/Default.aspx</link>
        <description> </description>
        <language>en-GB</language>
        <copyright>Elton Stoneman</copyright>
        <managingEditor>comments@sixeyed.com</managingEditor>
        <generator>Subtext Version 0.0.0.0</generator>
        <image>
            <title>Elton Stoneman</title>
            <url>http://geekswithblogs.net/images/RSS2Image.gif</url>
            <link>http://geekswithblogs.net/EltonStoneman/Default.aspx</link>
            <width>77</width>
            <height>60</height>
        </image>
        <item>
            <title>Mapping and Auto-Mapping Objects from IDataReader</title>
            <category>github</category>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2012/01/04/mapping-and-auto-mapping-objects-from-idatareader.aspx</link>
            <description>&lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal" align="center"&gt;&lt;span&gt;&lt;font style="font-size: 10pt"&gt;[Source: &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 10pt"&gt;&lt;a href="http://geekswithblogs.net/EltonStoneman"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;http://geekswithblogs.net/EltonStoneman&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 10pt"&gt;]&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;This is one in a series of posts covering my generic mapping library on github: &lt;span style="font-family: ; mso-bidi-font-size: 10.0pt; mso-ascii-theme-font: minor-latin; mso-fareast-font-family: 'MS Mincho'; mso-fareast-theme-font: minor-fareast; mso-hansi-theme-font: minor-latin; mso-bidi-font-family: 'Times New Roman'; mso-bidi-theme-font: minor-bidi; mso-ansi-language: en-gb; mso-fareast-language: en-gb; mso-bidi-language: ar-sa"&gt;&lt;a href="https://github.com/sixeyed/projects/tree/master/Sixeyed.Mapping"&gt;&lt;font color="#800080"&gt;Sixeyed.Mapping&lt;/font&gt;&lt;/a&gt;.&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpFirst"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;1.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;a href="http://geekswithblogs.net/EltonStoneman/archive/2012/01/03/mapping-and-auto-mapping-objects.aspx"&gt;Mapping and Auto-Mapping Objects&lt;/a&gt;&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;2.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Mapping and Auto-Mapping Objects from IDataReader&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;font color="#a5a5a5"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;3.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Mapping and Auto-Mapping Objects from XML&lt;/font&gt;&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;font color="#a5a5a5"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;4.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Mapping and Auto-Mapping Objects from CSV &lt;/font&gt;&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 10pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpLast"&gt;&lt;font color="#a5a5a5"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;5.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Comparing Sixeyed.Mapping to AutoMapper&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;The mapping library has support for &lt;b style="mso-bidi-font-weight: normal"&gt;IDataReader&lt;/b&gt; objects used as the source. Using data readers, AutoMap will try to populate the target by matching property names to column names. Alternatively a static map can be defined, manually specifying the mapping between column names and properties.&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Auto-Mapping&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Using a populated data reader as a source, you can auto-map a target object using the &lt;b style="mso-bidi-font-weight: normal"&gt;DataReaderAutoMap&lt;/b&gt; and the same syntax as for an object source:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#2b91af"&gt;&lt;font style="font-size: 9pt"&gt;IDataReader&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 9pt"&gt; reader = GetReader(id);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: "&gt;&lt;font color="#2b91af"&gt;&lt;font style="font-size: 9pt"&gt;User &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 9pt"&gt;user = &lt;span&gt;&lt;font color="#2b91af"&gt;DataReaderAutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;&amp;gt;.CreateTarget(reader);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt; &lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;The data reader must be open, and the map will populate from the current row so the data reader should be read to the desired start position before mapping. For a single row, call &lt;i style="mso-bidi-font-style: normal"&gt;Read()&lt;/i&gt; once on the reader before passing it to the &lt;i style="mso-bidi-font-style: normal"&gt;Create()&lt;/i&gt; call.&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;b style="mso-bidi-font-weight: normal"&gt;DataReaderAutoMap&lt;/b&gt; and &lt;b style="mso-bidi-font-weight: normal"&gt;AutoMap&lt;/b&gt; share the same base class, and the mapping logic is the same for all sources. Specification, caching strategy and naming strategy options still apply. To specify a property mapping, you need to provide the name of the source column:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: "&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 9pt"&gt;var &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 9pt"&gt;addressMap = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;DataReaderAutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;Address&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;.Specify(&lt;span&gt;&lt;font color="#a31515"&gt;"PostCode"&lt;/font&gt;&lt;/span&gt;, t =&amp;gt; t.PostCode.Code);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size: 9pt" color="#008000"&gt;//or:&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: "&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 9pt"&gt;var &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 9pt"&gt;addressMap = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;DataReaderAutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;Address&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;.Specify((s, t) =&amp;gt; t.PostCode.Code = (&lt;span&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;/span&gt;)s[&lt;span&gt;&lt;font color="#a31515"&gt;"PostCode"&lt;/font&gt;&lt;/span&gt;]);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size: 9pt"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;You can also use the conversion overloads for converting the source value during population:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: "&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 9pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 9pt"&gt; map = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;DataReaderAutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;.Specify&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;DateTime&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;DateTime&lt;/font&gt;&lt;/span&gt;&amp;gt;(&lt;span&gt;&lt;font color="#a31515"&gt;"JoinedDate"&lt;/font&gt;&lt;/span&gt;, t =&amp;gt; t.JoinedDate, sd =&amp;gt;FromLegacyDate(sd));&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size: 10pt"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Static Mapping&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;For static maps, extend the base &lt;b style="mso-bidi-font-weight: normal"&gt;DataReaderMap&lt;/b&gt; class. As we’re dealing with string constants for the column names, static maps may be the better option in caseswhere the source and target names can’t be matched by convention – they centralise the constant definition in one place:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt; &lt;span&gt;&lt;font color="#0000ff"&gt;class&lt;/font&gt;&lt;/span&gt; &lt;span&gt;&lt;font color="#2b91af"&gt;FullUserFromDataReaderMap&lt;/font&gt;&lt;/span&gt; : &lt;span&gt;&lt;font color="#2b91af"&gt;DataReaderMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;{&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span&gt;&lt;font color="#808080"&gt;///&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#008000"&gt; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 9pt" color="#808080"&gt;&amp;lt;summary&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span&gt;&lt;font color="#808080"&gt;///&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 9pt" color="#008000"&gt; Default constructor, initialises mapping&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span&gt;&lt;font color="#808080"&gt;///&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#008000"&gt; &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 9pt" color="#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt; FullUserFromDataReaderMap()&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;{&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;this&lt;/font&gt;&lt;/span&gt;.AutoMapUnspecifiedTargets = &lt;span&gt;&lt;font color="#0000ff"&gt;false&lt;/font&gt;&lt;/span&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;Specify(&lt;span&gt;&lt;font color="#2b91af"&gt;ColumnName&lt;/font&gt;&lt;/span&gt;.Id, t =&amp;gt; t.Id);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;Specify(&lt;span&gt;&lt;font color="#2b91af"&gt;ColumnName&lt;/font&gt;&lt;/span&gt;.FirstName, t =&amp;gt; t.FirstName);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font style="font-size: 9pt" color="#008000"&gt;//etc.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size: 9pt"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;private&lt;/font&gt;&lt;/span&gt; &lt;span&gt;&lt;font color="#0000ff"&gt;struct&lt;/font&gt;&lt;/span&gt; &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 9pt" color="#2b91af"&gt;ColumnName&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;{&lt;/font&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt; &lt;span&gt;&lt;font color="#0000ff"&gt;const&lt;/font&gt;&lt;/span&gt; &lt;span&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;/span&gt; Id = &lt;span&gt;&lt;font color="#a31515"&gt;"UserId"&lt;/font&gt;&lt;/span&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt; &lt;span&gt;&lt;font color="#0000ff"&gt;const&lt;/font&gt;&lt;/span&gt; &lt;span&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;/span&gt; FirstName = &lt;span&gt;&lt;font color="#a31515"&gt;"FirstName"&lt;/font&gt;&lt;/span&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font style="font-size: 9pt" color="#008000"&gt;//etc.&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt; &lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Nested Maps&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Maps can include nested maps, populating an object graph from a flattened representation in a single data reader:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: "&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 9pt"&gt;var &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 9pt"&gt;addressMap = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;DataReaderAutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;Address&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;.Specify(&lt;span&gt;&lt;font color="#a31515"&gt;"PostCode"&lt;/font&gt;&lt;/span&gt;, t =&amp;gt; t.PostCode.Code);&lt;/font&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                                    &lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: "&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 9pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 9pt"&gt; map = &lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;DataReaderAutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;.Specify(&lt;span&gt;&lt;font color="#a31515"&gt;"UserId"&lt;/font&gt;&lt;/span&gt;, t =&amp;gt; t.Id)&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;.Specify((s, t) =&amp;gt; t.Address = addressMap.Create(s));&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: "&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 9pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 9pt"&gt; user = map.Create(reader);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size: 9pt"&gt; &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Nested maps can also populate objects from multiple readers – although this requires each reader to be associated with a separate connection:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 9pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt; addressMap = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font color="#2b91af"&gt;DataReaderAutoMap&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 9pt"&gt;&amp;lt;&lt;span style="mso-no-proof: yes"&gt;&lt;font color="#2b91af"&gt;Address&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font style="font-size: 9pt"&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;.Specify((s, t) =&amp;gt; t.PostCode.Code = (&lt;span&gt;&lt;font color="#0000ff"&gt;string&lt;/font&gt;&lt;/span&gt;)s[&lt;span&gt;&lt;font color="#a31515"&gt;"PostCode"&lt;/font&gt;&lt;/span&gt;]);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 9pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt; map = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font color="#2b91af"&gt;DataReaderAutoMap&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 9pt"&gt;&amp;lt;&lt;span style="mso-no-proof: yes"&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font style="font-size: 9pt"&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;.Specify(&lt;span&gt;&lt;font color="#a31515"&gt;"UserId"&lt;/font&gt;&lt;/span&gt;, t =&amp;gt; t.Id)&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 9pt"&gt;                    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 9pt"&gt;.Specify((s, t) =&amp;gt; t.Address = addressMap.Create(addressReader));&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt 36pt" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 9pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 9pt"&gt; user = map.Create(userReader);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span style="font-family: "&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Limitations&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Data reader maps can only operate in one direction – populating an object from a reader. They also rely on the column names being available in the &lt;b style="mso-bidi-font-weight: normal"&gt;IDataReader&lt;/b&gt; implementation through the &lt;i style="mso-bidi-font-style: normal"&gt;GetOrdinal&lt;/i&gt; method. Not all data providers supply this, and if there are no column names available, mapping will fail for auto-maps and static maps, leaving the target object unpopulated.&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Performance&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Mapping from data readers uses the column names of the source, so only the target is reflected over. For small numbers of reads, there is less of a performance impact than with object-to-object mapping, and the benefits are greater as mapping also takes care of type conversion. Using a SqlServerCe database populated with 250,000 rows (80+Mb of data), the performance was bounded by the speed of the database connection and not the speed of mapping. Up to 1,000 are read and mapped in 0.4-0.6 seconds for all reads, with a small performance hit for the automap:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects-from-ID_12BEE/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects-from-ID_12BEE/image_thumb.png" border="0" height="285" width="473" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;For larger reads, the performance impact is more significant, with &lt;b style="mso-bidi-font-weight: normal"&gt;DataReaderAutoMap&lt;/b&gt; and a static &lt;b style="mso-bidi-font-weight: normal"&gt;DataReaderMap&lt;/b&gt; taking almost twice as long as manually reading and mapping the data, when you reach 100K or 250K reads:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects-from-ID_12BEE/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects-from-ID_12BEE/image_thumb_1.png" border="0" height="286" width="473" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;At 10K reads, performance is still comparable for auto-mapping and manual mapping, so whether you can use the &lt;b style="mso-bidi-font-weight: normal"&gt;DataReaderAutoMap&lt;/b&gt; would need to be looked at in context of your own data, mapping complexity and any upstream caching in your solution.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/148244.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2012/01/04/mapping-and-auto-mapping-objects-from-idatareader.aspx</guid>
            <pubDate>Wed, 04 Jan 2012 21:23:16 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/148244.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2012/01/04/mapping-and-auto-mapping-objects-from-idatareader.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/148244.aspx</wfw:commentRss>
        </item>
        <item>
            <title>End-to-end WCF code coverage with PowerShell</title>
            <category>PowerShell scripts</category>
            <category>MSBuild</category>
            <category>BDD</category>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2011/10/14/end-to-end-wcf-code-coverage-with-powershell.aspx</link>
            <description>		&lt;p&gt;I'm a big fan of automated testing which actually proves something. Unit tests may prove all the components in a solution work independently, but that doesn't mean you have a working solution. Integration tests give you confidence in the whole solution, but the cost of having a test suite with a lot of external dependencies is the risk of false build failures and long-running test suites.&lt;/p&gt;
		&lt;p&gt;To get something in between, we have acceptance tests written in &lt;a title="SpecFlow" href="http://www.specflow.org/" target="_blank"&gt;SpecFlow&lt;/a&gt; which run tests at the highest layer - targeting WCF services which are the external entry point to our solution. &lt;a href="http://geekswithblogs.net/michaelstephenson/archive/2011/07/18/146259.aspx"&gt;Michael Stephenson has blogged &lt;/a&gt;and &lt;a href="http://www.cloudcasts.net/Default.aspx?presenter=Mike%20Stephenson"&gt;given sessions&lt;/a&gt; on the power of BDD for unifying a project team's understanding of a feature, and being able to get code coverage based on features proves the solution works as expected through all scenarios. Acceptance tests use stubs for any external dependencies, so they run quickly and allow us to confidently assert that our solution works, provided the dependencies work as expected.&lt;/p&gt;
		&lt;p&gt;Getting coverage for a whole stack of .NET code running beneath the WCF layer is trickier than you might expect. There's no VS or MSBuild functionality for it, and you need to dig down to &lt;strong&gt;vsinstr &lt;/strong&gt;and &lt;strong&gt;vspercmd&lt;/strong&gt;. I've made it all as simple as possible with a generic PowerShell script you can call locally during development, and which runs as part of the MSBuild scripts on the server.&lt;/p&gt;
		&lt;p&gt;The script is on poshcode here: &lt;a href="http://poshcode.org/3141"&gt;&lt;span&gt;PowerShell script for running WCF code coverage against IIS&lt;/span&gt;&lt;/a&gt;.&lt;/p&gt;
		&lt;p&gt;Technically the script can be used to get coverage on any process which is hosted in IIS. The bulk of the work is done in functions in the script, the main block requires you to specify values for your own solution:&lt;/p&gt;
		&lt;p&gt;
				&lt;font size="2"&gt;
						&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;#--------------&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;# Script begins&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;#--------------&lt;/span&gt;
						&lt;br /&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;#set variables:&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #ff4500; FONT-FAMILY: Monospace"&gt;$solutionFriendlyName&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #a9a9a9; FONT-FAMILY: Monospace"&gt;=&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;'&lt;span style="BACKGROUND-COLOR: #99ccff"&gt;XYZ&lt;/span&gt;'&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #ff4500; FONT-FAMILY: Monospace"&gt;$wakeUpServiceUrl&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #a9a9a9; FONT-FAMILY: Monospace"&gt;=&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="BACKGROUND-COLOR: #99ccff"&gt;
								&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;'http://localhost/x.y.z/Service.svc&lt;/span&gt;
						&lt;/span&gt;
						&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;'&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #ff4500; FONT-FAMILY: Monospace"&gt;$appPoolName&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #a9a9a9; FONT-FAMILY: Monospace"&gt;=&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;'&lt;span style="BACKGROUND-COLOR: #99ccff"&gt;ap_XYZ&lt;/span&gt;'&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #ff4500; FONT-FAMILY: Monospace"&gt;$appPoolIdentity&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #a9a9a9; FONT-FAMILY: Monospace"&gt;=&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;'&lt;span style="BACKGROUND-COLOR: #99ccff"&gt;domain\svc_user&lt;/span&gt;'&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #ff4500; FONT-FAMILY: Monospace"&gt;$websiteBinDirectory&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #a9a9a9; FONT-FAMILY: Monospace"&gt;=&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;'&lt;span style="BACKGROUND-COLOR: #99ccff"&gt;C:\websites\xyz\x.y.z.Services\bin&lt;/span&gt;'&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #ff4500; FONT-FAMILY: Monospace"&gt;$coverageOutputPath&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #a9a9a9; FONT-FAMILY: Monospace"&gt;=&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;"Test.coverage"&lt;/span&gt;
						&lt;br /&gt;
						&lt;br /&gt;
				&lt;/font&gt;
				&lt;font size="2"&gt;
						&lt;span style="BACKGROUND-COLOR: #99ccff"&gt;
								&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;#instrument assemblies:&lt;/span&gt;
								&lt;br /&gt;
								&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;# - instrument assembly so ALL namespaces are included in coverage&lt;/span&gt;
								&lt;br /&gt;
								&lt;span style="COLOR: #0000ff; FONT-FAMILY: Monospace"&gt;instrument&lt;/span&gt;
								&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
								&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;"x.y.z.Services.dll"&lt;/span&gt;
								&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
								&lt;br /&gt;
								&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;# - instrument assembly so anything from the Ignore1 and Ignore2 namespaces are excluded from coverage&lt;/span&gt;
								&lt;br /&gt;
								&lt;span style="COLOR: #0000ff; FONT-FAMILY: Monospace"&gt;instrument&lt;/span&gt;
								&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
								&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;"x.y.z.Core.dll"&lt;/span&gt;
								&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
								&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;'x.y.z.Core.Ignore1.*'&lt;/span&gt;
								&lt;span style="COLOR: #a9a9a9; FONT-FAMILY: Monospace"&gt;,&lt;/span&gt;
								&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;'x.y.z.Core.Ignore2.*'&lt;/span&gt;
								&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
								&lt;br /&gt;
						&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;#instrument W3WP, run tests &amp;amp; export results:&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #0000ff; FONT-FAMILY: Monospace"&gt;start-instrumentation&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #a9a9a9; FONT-FAMILY: Monospace"&gt;&amp;amp;&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #8b0000; FONT-FAMILY: Monospace"&gt;'C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe'&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #8a2be2; FONT-FAMILY: Monospace"&gt;Build.proj&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #8a2be2; FONT-FAMILY: Monospace"&gt;/t:$msBuildTarget&lt;/span&gt;
						&lt;span style="COLOR: #000000; FONT-FAMILY: Monospace"&gt; &lt;/span&gt;
						&lt;span style="COLOR: #8a2be2; FONT-FAMILY: Monospace"&gt;/p:ConfigurationName=$configurationName&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #0000ff; FONT-FAMILY: Monospace"&gt;stop-instrumentation&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #0000ff; FONT-FAMILY: Monospace"&gt;export-coverage&lt;/span&gt;
						&lt;br /&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;#------------&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;# Script ends&lt;/span&gt;
						&lt;br /&gt;
						&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;#------------&lt;/span&gt;
				&lt;/font&gt;
		&lt;/p&gt;
		&lt;p&gt;
				&lt;span style="COLOR: #006400; FONT-FAMILY: Monospace"&gt;
						&lt;font color="#000000" face="Times New Roman"&gt;The sections &lt;span style="BACKGROUND-COLOR: #99ccff"&gt;highlighted in blue &lt;/span&gt;above need to be replaced with your own values:&lt;/font&gt;
				&lt;/span&gt;
		&lt;/p&gt;
		&lt;ul&gt;
				&lt;li&gt;
						&lt;font face="Times New Roman"&gt;
								&lt;span style="COLOR: #006400"&gt;
										&lt;font color="#000000"&gt;
												&lt;strong&gt;solutionFriendlyName&lt;/strong&gt; - just a friendly name which is used in logging output&lt;/font&gt;
								&lt;/span&gt;
						&lt;/font&gt;
				&lt;/li&gt;
				&lt;li&gt;
						&lt;font face="Times New Roman"&gt;
								&lt;span style="COLOR: #006400"&gt;
										&lt;font color="#000000"&gt;
												&lt;strong&gt;wakeUpServiceUrl&lt;/strong&gt; - any URL which is part of your solution. The script hits the URL to start an app pool which is can instrument for code coverage. Can be anything which fires up the worker process - .svc, .aspx etc.;&lt;/font&gt;
								&lt;/span&gt;
						&lt;/font&gt;
				&lt;/li&gt;
				&lt;li&gt;
						&lt;font face="Times New Roman"&gt;
								&lt;span style="COLOR: #006400"&gt;
										&lt;font color="#000000"&gt;
												&lt;strong&gt;appPoolName&lt;/strong&gt; - the name of the app pool your solution runs under. Ideally have a dedicated app pool as the covergae run stops and starts it, so if it's dedicated to the solution you won't impact anything else;&lt;/font&gt;
								&lt;/span&gt;
						&lt;/font&gt;
				&lt;/li&gt;
				&lt;li&gt;
						&lt;font face="Times New Roman"&gt;
								&lt;span style="COLOR: #006400"&gt;
										&lt;font color="#000000"&gt;
												&lt;strong&gt;appPoolIdentity&lt;/strong&gt; - the service account the app pool runs under. Used in setting up instrumentation;&lt;/font&gt;
								&lt;/span&gt;
						&lt;/font&gt;
				&lt;/li&gt;
				&lt;li&gt;
						&lt;font face="Times New Roman"&gt;
								&lt;span style="COLOR: #006400"&gt;
										&lt;font color="#000000"&gt;
												&lt;strong&gt;websiteBinDirectory&lt;/strong&gt; - path to the binaries you want to be instrumented, where the IIS site is running;&lt;/font&gt;
								&lt;/span&gt;
						&lt;/font&gt;
				&lt;/li&gt;
				&lt;li&gt;
						&lt;font face="Times New Roman"&gt;
								&lt;span style="COLOR: #006400"&gt;
										&lt;font color="#000000"&gt;
												&lt;strong&gt;coverageOutputPath&lt;/strong&gt; - specify what the coverage file will be called. Should have the .coverage extension;&lt;/font&gt;
								&lt;/span&gt;
						&lt;/font&gt;
				&lt;/li&gt;
				&lt;li&gt;
						&lt;font face="Times New Roman"&gt;
								&lt;span style="COLOR: #006400"&gt;
										&lt;font color="#000000"&gt;instrument - add a line for every assembly you want to instrument. If the assembly contains just your code, you only need to name the assembly. If it contains generated code you don't want included (e.g. service reference or EF model code), specify each namespace to exclude after the assembly name. Syntax is important here - &lt;i&gt;each namespace should be fully-specified up to the wildcard, quoted in single quotes, and multiple namespaces are comma-separated&lt;/i&gt;.&lt;/font&gt;
								&lt;/span&gt;
						&lt;/font&gt;
				&lt;/li&gt;
		&lt;/ul&gt;
		&lt;p&gt;The script has some expectations which mean hardcoded values in the functions, so if your environment is different you'll need to look at those:&lt;/p&gt;
		&lt;ul&gt;
				&lt;li&gt;running on Windows Server (expects to instrument W3WP.exe) 
&lt;/li&gt;
				&lt;li&gt;VS2010 installed at default path 
&lt;/li&gt;
				&lt;li&gt;.NET 4 installed &lt;/li&gt;
		&lt;/ul&gt;
		&lt;p&gt;In our build scripts, we have one target to run the tests, and another to run the tests with coverage. The PowerShell script calls back into the original MSBuild script to run the unit tests, so to incorporate the script into your build you need a target like this:&lt;/p&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: blue; FONT-FAMILY: Consolas"&gt; &amp;lt;&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: #a31515; FONT-FAMILY: Consolas"&gt;Target&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Consolas"&gt;Name&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: blue; FONT-FAMILY: Consolas"&gt;=&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;"&lt;span style="COLOR: blue"&gt;AcceptanceTestsWithCoverage&lt;/span&gt;"&lt;span style="COLOR: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: blue; FONT-FAMILY: Consolas"&gt;    &amp;lt;&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: #a31515; FONT-FAMILY: Consolas"&gt;Exec&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: red; FONT-FAMILY: Consolas"&gt;ContinueOnError&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: blue; FONT-FAMILY: Consolas"&gt;=&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;"&lt;span style="COLOR: blue"&gt;true&lt;/span&gt;"&lt;span style="COLOR: red"&gt;Command&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;'&lt;span style="COLOR: blue"&gt;powershell.exe "$(MSBuildProjectDirectory)\RunCoverage.ps1 -msBuildTarget AcceptanceTests -configurationName $(ConfigurationName)"&lt;/span&gt;'&lt;span style="COLOR: red"&gt;WorkingDirectory&lt;/span&gt;&lt;span style="COLOR: blue"&gt;=&lt;/span&gt;'&lt;span style="COLOR: blue"&gt;$(MSBuildProjectDirectory)&lt;/span&gt;'&lt;span style="COLOR: blue"&gt; /&amp;gt;&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: blue; FONT-FAMILY: Consolas"&gt; &amp;lt;/&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: #a31515; FONT-FAMILY: Consolas"&gt;Target&lt;/span&gt;
				&lt;span style="FONT-SIZE: 8pt; COLOR: blue; FONT-FAMILY: Consolas"&gt;&amp;gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;p&gt;- passing the script the name of the MSBuild target to run to execute the tests.&lt;/p&gt;
		&lt;p&gt;The output from the script is a .coverage file which you can load into VS (note that if you rebuild after running coverage, the assemblies will not be instrumented and the coverage won't load correctly), and an XML export of the coverage (which you can roll up in your build scripts, or load into VS).&lt;/p&gt;
		&lt;p&gt; &lt;/p&gt;
 &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/147305.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2011/10/14/end-to-end-wcf-code-coverage-with-powershell.aspx</guid>
            <pubDate>Fri, 14 Oct 2011 09:53:44 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/147305.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2011/10/14/end-to-end-wcf-code-coverage-with-powershell.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/147305.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Mapping and Auto-Mapping Objects</title>
            <category>github</category>
            <category>Fluent</category>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2012/01/03/mapping-and-auto-mapping-objects.aspx</link>
            <description>&lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal" align="center"&gt;&lt;span&gt;&lt;font style="font-size: 10pt"&gt;[Source: &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 10pt"&gt;&lt;a href="http://geekswithblogs.net/EltonStoneman"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;http://geekswithblogs.net/EltonStoneman&lt;/font&gt;&lt;/span&gt;&lt;/a&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 10pt"&gt;]&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;This is the first of a series of posts covering my generic &lt;span style="mso-spacerun: yes"&gt; &lt;/span&gt;anything-to-object mapping library on github: &lt;a href="https://github.com/sixeyed/projects/tree/master/Sixeyed.Mapping"&gt;&lt;font color="#800080"&gt;Sixeyed.Mapping&lt;/font&gt;&lt;/a&gt;.&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpFirst"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin"&gt;&lt;span style="mso-list: ignore"&gt;1.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Mapping and Auto-Mapping Objects&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;a href="http://geekswithblogs.net/EltonStoneman/archive/2012/01/04/mapping-and-auto-mapping-objects-from-idatareader.aspx"&gt;&lt;font color="#000000"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: background1; mso-themeshade: 166"&gt;&lt;span style="mso-list: ignore"&gt;2.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-themecolor: background1; mso-themeshade: 166"&gt;Mapping and Auto-Mapping Objects from IDataReader&lt;/span&gt;&lt;/font&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;font color="#a6a6a6"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: background1; mso-themeshade: 166"&gt;&lt;span style="mso-list: ignore"&gt;3.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-themecolor: background1; mso-themeshade: 166"&gt;Mapping and Auto-Mapping Objects from XML&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 0pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpMiddle"&gt;&lt;font color="#a6a6a6"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: background1; mso-themeshade: 166"&gt;&lt;span style="mso-list: ignore"&gt;4.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-themecolor: background1; mso-themeshade: 166"&gt;Mapping and Auto-Mapping Objects from CSV &lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="text-indent: -18pt; margin: 0cm 0cm 10pt 36pt; mso-list: l0 level1 lfo1" class="MsoListParagraphCxSpLast"&gt;&lt;font color="#a6a6a6"&gt;&lt;span style="mso-fareast-font-family: calibri; mso-fareast-theme-font: minor-latin; mso-bidi-font-family: calibri; mso-bidi-theme-font: minor-latin; mso-themecolor: background1; mso-themeshade: 166"&gt;&lt;span style="mso-list: ignore"&gt;5.&lt;span style="line-height: normal; font-family: "&gt;&lt;font face="Times New Roman"&gt;&lt;font style="font-size: 7pt"&gt;       &lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="mso-themecolor: background1; mso-themeshade: 166"&gt;Comparing Sixeyed.Mapping to AutoMapper&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Enterprise projects typically have entities of the same kind defined multiple times to encapsulate different representations. A &lt;strong&gt;User&lt;/strong&gt; domain entity may be projected into a UserModel, containing a flattened subset of the User properties for display:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_thumb.png" border="0" height="292" width="506" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;With layers for domain entities, data contracts, service contract requests and responses, and presentation models you may have five definitions of a related entity, all of which are under your control, and all of which will (hopefully) have consistent naming conventions. Code to manually map between entity representations looks unnecessary as the source and target are so similar:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#2b91af"&gt;&lt;font style="font-size: 8pt"&gt;User&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; user = GetFullUser();&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#2b91af"&gt;&lt;font style="font-size: 8pt"&gt;UserModel&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; model = &lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;{&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;DateOfBirth = user.DateOfBirth,&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;FirstName = user.FirstName,&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Id = user.Id,&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;LastName = user.LastName&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//Intentionally leave out AddressLine1 for now&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;};&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;This is time-consuming, error-prone, and can add a huge maintenance overhead when properties are added or removed. Neater to use a generic auto-map, which matches properties between target and source entities, and populates target objects:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#2b91af"&gt;&lt;font style="font-size: 8pt"&gt;User&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; user = GetFullUser();&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; model = &lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;.CreateTarget(user);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;a href="https://github.com/sixeyed/projects/tree/master/Sixeyed.Mapping"&gt;&lt;font color="#800080"&gt;Sixeyed.Mapping on github&lt;/font&gt;&lt;/a&gt; provides functionality for auto-mapping, and for creating static maps. (For an alternative, &lt;a href="http://www.lostechies.com/blogs/jimmy_bogard/archive/2009/01/22/automapper-the-object-object-mapper.aspx"&gt;&lt;font color="#0000ff"&gt;Jimmy Bogard’sAutoMapper on CodePlex&lt;/font&gt;&lt;/a&gt;, is well established but it has a different approach. I wanted a consistent interface for auto maps and manual maps, the ability to map from different sources, and a smaller performance hit - see&lt;span style="mso-themecolor: background1; mso-themeshade: 166"&gt;&lt;font color="#a6a6a6"&gt; Comparing Sixeyed.Mapping to AutoMapper&lt;/font&gt;&lt;/span&gt;).&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Auto-Mapping&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Auto-mapping is done at runtime, so when the entity definitions change there are no upstream code changes. AutoMap uses reflection, but the performance hit is relatively small and the map can be cached if it’s going to be used repeatedly. The example above is the simplest, but for cases which aren’t covered by discoverable mappings, you can specify individual property mapping actions:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; map = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;                &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;.Specify((s, t) =&amp;gt; t.AddressLine1 = s.Address.Line1) &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//flatten&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;                &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;.Specify((s, t) =&amp;gt; t.FirstName = s.FirstName.ToUpper()) &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//convert&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;                &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;.Specify((s, t) =&amp;gt; t.Address = &lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;Address&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;PartialAddress&lt;/font&gt;&lt;/span&gt;&amp;gt;.CreateTarget(s.Address)); &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//nested map&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt 36pt" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; model = map.Create(user);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Any properties not explicitly specified are auto-mapped. Mapping degrades gracefully, so any properties which can’t be mapped (either because the names can’t be matched, or the source cannot be read from, or the target cannot be written to) are not populated. (Optionally you can force exceptions to be thrown on mismatches).&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;AutoMap uses a naming strategy to match properties. By default this uses a simple matching algorithm, ignoring case and stripping non-alphanumeric characters. You can override the default to use exact name matching, aggressive name matching (which acts like the simple match but additionally strips vowels and double-letters), or to supply your own strategy (implementing &lt;b style="mso-bidi-font-weight: normal"&gt;IMatchingStrategy&lt;/b&gt;):&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; map = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;(); &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//matches "IsValid" and "IS_VALID"&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; exactMap = &lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size: 8pt"&gt;.Matching&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;ExactNameMatchingStrategy&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt;; &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//matches "IsValid" and "IsValid"&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; aggressiveMap = &lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: "&gt;&lt;font face="Courier New"&gt;&lt;font style="font-size: 8pt"&gt;.Matching&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;AggressiveNameMatchingStrategy&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//matches "IsValid" and "ISVLD"&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; customMap = &lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt 36pt" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;                        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;.&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 8pt"&gt;Matching&lt;/font&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;LegacyNameMatchingStrategy&lt;/font&gt;&lt;/span&gt;&amp;gt;(); &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//custom, matches "IsValid" and "bit_ISVALID"&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Internally, AutoMap uses the naming strategy to generate a list of &lt;b style="mso-bidi-font-weight: normal"&gt;IPropertyMapping&lt;/b&gt; objects which represent maps between source and target properties. By default the list is only cached for the lifetime of the map, so the performance cost of reflecting over the types is incurred every time an AutoMap is instantiated and used. The justification for this is that the mapping cache will grow unknowably large, so a simple dictionary cache could end up with a large memory footprint. Equally the performance hit is small, and .NET uses internal caching for reflected types, so in subsequent generations of the same type of map the performance hit will be smaller.&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;AutoMap does provide a caching strategy if you do want the mappings cached. You can either use the internal cache (which is a simple dictionary and will never be flushed), the standard .NET runtime cache, or provide a wrapper over your own caching layer with an &lt;b style="mso-bidi-font-weight: normal"&gt;ICachingStrategy&lt;/b&gt; implementation:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; map = &lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;(); &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//mappings not cached&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; dictionaryMap = &lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;                             &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;.&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 8pt"&gt;Cache&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;DictionaryCachingStrategy&lt;/font&gt;&lt;/span&gt;&amp;gt;(&lt;/font&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt;); &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//mappings cached in dictionary&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; cachedMap = &lt;span&gt;&lt;font color="#0000ff"&gt;new&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt;.&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: "&gt;&lt;font style="font-size: 8pt"&gt;Cache&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;MemoryCacheCachingStrategy&lt;/font&gt;&lt;/span&gt;&amp;gt;&lt;/font&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt;(); &lt;/font&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//mappings cached in .NET runtime cache&lt;/font&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt; &lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt; mso-outline-level: 1" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Static Mapping&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;For complex maps, or for scenarios where you don’t want the reflection performance hit at all, you can define a static map. The interface is the same as AutoMap, except by default all properties have to be specified – there is no auto-mapping of unspecified targets, so additionally the naming and caching strategies are ignored.&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Static object maps are derived from ClassMap, with the specifications made in the constructor (&lt;a href="http://fluentnhibernate.org/"&gt;&lt;font color="#0000ff"&gt;FluentNHibernate&lt;/font&gt;&lt;/a&gt;-style):&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public class&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;UserToUserModelMap&lt;/font&gt;&lt;/span&gt; : &lt;span&gt;&lt;font color="#2b91af"&gt;ClassMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;{&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="text-indent: 36pt; margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;public&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; UserToUserModelMap()&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;{&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify(s =&amp;gt; s.Id, t =&amp;gt; t.Id);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify(s =&amp;gt; s.FirstName, t =&amp;gt; t.FirstName);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify(s =&amp;gt; s.LastName, t =&amp;gt; t.LastName);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify((s, t) =&amp;gt; t.AddressLine1 = s.Address.Line1);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify((s, t) =&amp;gt; t.Address.PostCode = s.Address.PostCode.Code);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;There are various &lt;i style="mso-bidi-font-style: normal"&gt;Specify&lt;/i&gt; overloads, so you can specify mappings in an action, or specify source and target with funcs as you prefer. Execute the map in the same way by calling Create or Populate to map from the source instance to a target:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#2b91af"&gt;&lt;font style="font-size: 8pt"&gt;User&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; user = GetFullUser();&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt 36pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#0000ff"&gt;&lt;font style="font-size: 8pt"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; map = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;UserToUserModelMap&lt;/font&gt;&lt;/span&gt;();&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt 36pt" class="MsoNormal"&gt;&lt;font face="Courier New"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font color="#2b91af"&gt;&lt;font style="font-size: 8pt"&gt;UserModel&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font style="font-size: 8pt"&gt; model = map.Create(user);&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;You can mix-and-match static and auto-mapping by setting &lt;i style="mso-bidi-font-style: normal"&gt;AutoMapUnspecifiedTargets&lt;/i&gt;, meaning that the auto-map will be used for any target properties which have not been explicitly specified:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public class &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;UserToUserModelMap&lt;/font&gt;&lt;/span&gt; : &lt;span&gt;&lt;font color="#2b91af"&gt;ClassMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;{&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;&lt;span&gt;&lt;font color="#0000ff"&gt;public&lt;/font&gt;&lt;/span&gt; UserToUserModelMap()&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;{&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;AutoMapUnspecifiedTargets = &lt;span&gt;&lt;font color="#0000ff"&gt;true&lt;/font&gt;&lt;/span&gt;;&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify((s, t) =&amp;gt; t.AddressLine1 = s.Address.Line1);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;            &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify((s, t) =&amp;gt; t.Address.PostCode = s.Address.PostCode.Code);&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;        &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;}&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;This also allows your static map to leverage the naming and caching strategies of AutoMap.&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Nested Maps&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;AutoMap doesn’t traverse object graphs, it will only populate properties in the first-level object (except where you have specified a mapping for a child object). To populate full graphs you can use nested auto-maps or static maps, with one of the &lt;i style="mso-bidi-font-style: normal"&gt;Specify&lt;/i&gt; overloads to supply a conversion which invokes the map on the target property:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify((s, t) =&amp;gt; t.User = &lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;FullUserToPartialUserMap&lt;/font&gt;&lt;/span&gt;().Create(s.User));&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//or:&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify(s =&amp;gt; s.User, t =&amp;gt; t.User, c =&amp;gt;&lt;span&gt;&lt;font color="#0000ff"&gt;new &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font color="#2b91af"&gt;FullUserToPartialUserMap&lt;/font&gt;&lt;/span&gt;().Create(c));&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 0pt; mso-layout-grid-align: none" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;font style="font-size: 8pt" color="#008000"&gt;//or:&lt;/font&gt;&lt;/span&gt;&lt;/font&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="font-family: ; mso-no-proof: yes"&gt;&lt;font face="Courier New"&gt;&lt;span style="mso-spacerun: yes"&gt;&lt;font style="font-size: 8pt"&gt;    &lt;/font&gt;&lt;/span&gt;&lt;font style="font-size: 8pt"&gt;Specify((s, t) =&amp;gt; t.User = &lt;span&gt;&lt;font color="#2b91af"&gt;AutoMap&lt;/font&gt;&lt;/span&gt;&amp;lt;&lt;span&gt;&lt;font color="#2b91af"&gt;User&lt;/font&gt;&lt;/span&gt;, &lt;span&gt;&lt;font color="#2b91af"&gt;UserModel&lt;/font&gt;&lt;/span&gt;&amp;gt;.CreateTarget(s.User));&lt;/font&gt;&lt;/font&gt;&lt;/span&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;i style="mso-bidi-font-style: normal"&gt;Performance&lt;/i&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;As always, the generic solution has a performance implication, although the mapping has had a couple of rounds of optimisation done to minimise the overhead. The highest-value AutoMap solution, which removes as much code and maintenance overhead as possible, has the highest impact. Populating 250,000 objects, the static AutoMap&amp;lt;&amp;gt;.CreateTarget() method takes 13 seconds, compared to 5 seconds for manually populating the targets.&lt;span style="mso-spacerun: yes"&gt;  &lt;/span&gt;Caching the map reduces the time to 8 seconds, and generating the map once and reusing it reduces it again to 7 seconds. Using a static map takes 6 seconds:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_thumb_1.png" border="0" height="119" width="430" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;In a more representative sample, mapping a single object, the disparity is not so pronounced. Manual and AutoMap versions take approximately the same time; in different test runs, one will be quicker than the other. The static map is consistently faster than manually populating the target object (what? Yes. Possibly due to the &lt;a href="http://msmvps.com/blogs/jon_skeet/archive/2008/08/09/making-reflection-fly-and-exploring-delegates.aspx"&gt;&lt;font color="#0000ff"&gt;hard-core reflection optimisation technique from Jon Skeet&lt;/font&gt;&lt;/a&gt;):&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_thumb_2.png" border="0" height="84" width="432" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Up to 1,000 objects, the performance hit in using the AutoMap is negligible:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_8.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_thumb_3.png" border="0" height="288" width="477" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Above 1,000 objects the cost is more pronounced:&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;a href="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_10.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" alt="image" src="http://geekswithblogs.net/images/geekswithblogs_net/EltonStoneman/Windows-Live-Writer/Mapping-and-Auto-Mapping-Objects_14768/image_thumb_4.png" border="0" height="288" width="477" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;&lt;span style="mso-no-proof: yes"&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;Note that the effort in mapping is computational, not memory-bound, so in a higher-spec system the differences will be smaller.&lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;In a production system, adding 0.0x seconds to a service call involving a database lookup or a service call is likely to be acceptable, especially if the map is used for a single object, or the map can be reused – in which case the overhead will be 0.00x seconds. Likewise if you’re populating a single model for a view, it’s likely to be justifiable for the reduction in the solution’s technical debt. &lt;/p&gt;  &lt;p style="margin: 0cm 0cm 10pt" class="MsoNormal"&gt;In different scenarios, the computation of the AutoMap may be an unacceptable performance hit, in which case a static map at least isolates the mapping logic and provides some of the benefits, at a lower performance cost.&lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/148232.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2012/01/03/mapping-and-auto-mapping-objects.aspx</guid>
            <pubDate>Tue, 03 Jan 2012 23:22:52 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/148232.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2012/01/03/mapping-and-auto-mapping-objects.aspx#feedback</comments>
            <slash:comments>2</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/148232.aspx</wfw:commentRss>
        </item>
        <item>
            <title>ExpectedException in MSTest does not check the exception message</title>
            <category>Unit Testing</category>
            <category>.NET 4.0</category>
            <category>Code Snippet</category>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2011/09/30/expectedexception-in-mstest-does-not-check-the-exception-message.aspx</link>
            <description>		&lt;p&gt;When you're writing a unit test to verify that an exception is thrown and you want to check the content of the error message, the &lt;strong&gt;ExpectionException &lt;/strong&gt;attribute doesn't do it.&lt;/p&gt;
		&lt;p&gt;This code (which you see a lot):&lt;/p&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        [&lt;span style="COLOR: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        [&lt;span style="COLOR: #2b91af"&gt;ExpectedException&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;ValidationException&lt;/span&gt;), &lt;span style="COLOR: #a31515"&gt;"Postcode must be provided"&lt;/span&gt;)]&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;void&lt;/span&gt; PostcodeIsNullOrWhitespace()&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        {&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            &lt;span style="COLOR: green"&gt;//etc.&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt; &lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        }&lt;/span&gt; &lt;/div&gt;
		&lt;p&gt;- checks that an exception is thrown, and the test will pass if the exception is of type &lt;strong&gt;ValidationException&lt;/strong&gt;. The second parameter of the &lt;strong&gt;ExpectedException &lt;/strong&gt;attribute is the string that will be written in the MSTest output if the test fails, &lt;em&gt;so this test is not checking the content of the exception message&lt;/em&gt;.&lt;/p&gt;
		&lt;p&gt;If you do want to test the exception message as well as the exception type, this utility method does it for you:&lt;/p&gt;
		&lt;p&gt;
		&lt;/p&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: green"&gt; Runs the action statement and asserts that it causes an exception with the expected type and message&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;typeparam name="TException"&amp;gt;&amp;lt;/typeparam&amp;gt;&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param name="action"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        &lt;span style="COLOR: gray"&gt;///&lt;/span&gt;&lt;span style="COLOR: gray"&gt;&amp;lt;param name="expectedMessage"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&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; AssertRaisesException&amp;lt;TException&amp;gt;(&lt;span style="COLOR: #2b91af"&gt;Action&lt;/span&gt; action, &lt;span style="COLOR: blue"&gt;string&lt;/span&gt; expectedMessage)&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            &lt;span style="COLOR: blue"&gt;where&lt;/span&gt; TException : &lt;span style="COLOR: #2b91af"&gt;Exception&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        {&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            &lt;span style="COLOR: blue"&gt;try&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            {&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;                action();&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;                &lt;span style="COLOR: #2b91af"&gt;Assert&lt;/span&gt;.Fail(&lt;span style="COLOR: #a31515"&gt;"Call suceeded. Expected exception of type: {0} with message: {1}"&lt;/span&gt;.FormatWith(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(TException).Name, expectedMessage));&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            }&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            &lt;span style="COLOR: blue"&gt;catch&lt;/span&gt; (&lt;span style="COLOR: #2b91af"&gt;Exception&lt;/span&gt; ex)&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            {&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;                &lt;span style="COLOR: blue"&gt;if&lt;/span&gt; (ex &lt;span style="COLOR: blue"&gt;is&lt;/span&gt;&lt;span style="COLOR: #2b91af"&gt;AssertFailedException&lt;/span&gt;)&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;                    &lt;span style="COLOR: blue"&gt;throw&lt;/span&gt; ex;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt; &lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;                &lt;span style="COLOR: blue"&gt;var&lt;/span&gt; exception = ex &lt;span style="COLOR: blue"&gt;as&lt;/span&gt; TException;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;                &lt;span style="COLOR: #2b91af"&gt;Assert&lt;/span&gt;.IsNotNull(exception, &lt;span style="COLOR: #a31515"&gt;"Expected exception of type: {0}, actual type: {1}"&lt;/span&gt;.FormatWith(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(TException).Name, ex.GetType().Name));&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;                &lt;span style="COLOR: #2b91af"&gt;Assert&lt;/span&gt;.AreEqual(expectedMessage, exception.Message, &lt;span style="COLOR: #a31515"&gt;"Expected message: {0}"&lt;/span&gt;.FormatWith(expectedMessage));&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            }&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        }&lt;/span&gt;
		&lt;/div&gt;
		&lt;p&gt;Usage:&lt;/p&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        [&lt;span style="COLOR: #2b91af"&gt;TestMethod&lt;/span&gt;]&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        [&lt;span style="COLOR: #2b91af"&gt;ExpectedException&lt;/span&gt;(&lt;span style="COLOR: blue"&gt;typeof&lt;/span&gt;(&lt;span style="COLOR: #2b91af"&gt;ValidationException&lt;/span&gt;))]&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        &lt;span style="COLOR: blue"&gt;public&lt;/span&gt;&lt;span style="COLOR: blue"&gt;void&lt;/span&gt; PostcodeIsNullOrWhitespace()&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        {&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            &lt;span style="COLOR: blue"&gt;var&lt;/span&gt; postcode = &lt;span style="COLOR: #a31515"&gt;" "&lt;/span&gt;;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            AssertRaisesException&amp;lt;&lt;span style="COLOR: #2b91af"&gt;ValidationException&lt;/span&gt;&amp;gt;(() =&amp;gt; ValidatePostcode(postcode), &lt;span style="COLOR: #a31515"&gt;"Postcode must be provided"&lt;/span&gt;);&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;            &lt;span style="COLOR: green"&gt;//etc.&lt;/span&gt;&lt;/span&gt;
		&lt;/div&gt;
		&lt;div&gt;
				&lt;span style="FONT-SIZE: 8pt; FONT-FAMILY: Consolas"&gt;        }&lt;/span&gt;
		&lt;/div&gt;
 &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/147119.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2011/09/30/expectedexception-in-mstest-does-not-check-the-exception-message.aspx</guid>
            <pubDate>Fri, 30 Sep 2011 14:08:10 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/147119.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2011/09/30/expectedexception-in-mstest-does-not-check-the-exception-message.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/147119.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Specifying parameterless constructors in Unity configuration</title>
            <category>Unity</category>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2011/10/04/specifying-parameterless-constructors-in-unity-configuration.aspx</link>
            <description>&lt;p&gt;When you ask Unity to resolve a type with multiple constructors, by default it picks the constructor with the most parameters, to facilitate maximum dependency injection.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://www.dotnetconsult.co.uk/weblog2/default.aspx"&gt;Richard Blewett&lt;/a&gt; has a good post on &lt;a href="http://www.dotnetconsult.co.uk/weblog2/PermaLink,guid,adb974bc-7595-4e06-827b-12f7c09208ae.aspx"&gt;specifying a different constuctor in config&lt;/a&gt;, but it doesn't cover the scenario when the constructor you want is the default, parameterless constructor.&lt;/p&gt;
&lt;p&gt;The documentation is a bit lacking, although the config is logical - here's how it looks:&lt;/p&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt; &amp;lt;&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;unity&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;    &amp;lt;&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;containers&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;      &amp;lt;&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;container&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;        &amp;lt;&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;types&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;          &amp;lt;&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;type&lt;/span&gt;&lt;span style="font-size: 8pt; color: red; font-family: Consolas"&gt;type&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;=&lt;/span&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;"&lt;span style="color: blue"&gt;x.y.z.Spec.IInterface,x.y.z&lt;/span&gt;"&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;                &lt;/span&gt;&lt;span style="font-size: 8pt; color: red; font-family: Consolas"&gt;mapTo&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;=&lt;/span&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;"&lt;span style="color: blue"&gt;x.y.z.Impl.Implementation,x.y.z&lt;/span&gt;"&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;            &amp;lt;&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;constructor&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;/&amp;gt; &amp;lt;!--&lt;/span&gt;&lt;span style="font-size: 8pt; color: green; font-family: Consolas"&gt; force use of default constructor &lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;--&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;          &amp;lt;/&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;type&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;        &amp;lt;/&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;types&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;      &amp;lt;/&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;container&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;    &amp;lt;/&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;containers&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt; &amp;lt;/&lt;/span&gt;&lt;span style="font-size: 8pt; color: #a31515; font-family: Consolas"&gt;unity&lt;/span&gt;&lt;span style="font-size: 8pt; color: blue; font-family: Consolas"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/147175.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2011/10/04/specifying-parameterless-constructors-in-unity-configuration.aspx</guid>
            <pubDate>Tue, 04 Oct 2011 09:34:24 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/147175.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2011/10/04/specifying-parameterless-constructors-in-unity-configuration.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/147175.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Distributing WCF service load vertically as well as horizontally</title>
            <category>WCF</category>
            <category>nServiceBus</category>
            <category>github</category>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2011/12/16/distributing-wcf-service-load-vertically-as-well-as-horizontally.aspx</link>
            <description>		&lt;p&gt;&lt;b&gt;Overview&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;I've been looking into a solution recently which has a series of remote nodes publishing events to a central node. The publishers have no logic, they just need to contact the central node and record that an event has happened. Off the back of that, the central node does some work inferring what the event means, and computing its relationship to a bunch of other events. Simple enough, but the solution needs to be scalable and make efficient use of its resources.&lt;/p&gt;
		&lt;p&gt;I started off building it around NServiceBus, but when I had a better understanding of the components and the physical architecture, decided on a different approach. The central node will most likely be an EC2 cluster; using NServiceBus, cluster nodes can communicate with each other's queues, but the remote nodes would need a bridging mechanism to talk to the central node, and I'd rather have a consistent communication model. So I started rebuilding the service layer in WCF, but I wanted flexibility on how the central cluster nodes distributed work amongst themselves.&lt;/p&gt;
		&lt;p&gt;&lt;b&gt;Solution&lt;/b&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Briefly, I wanted a nice solution for this scenario: remote nodes will always talk to the central cluster over HTTP with a REST service; central nodes will distribute load amongst themselves as efficiently as they can. In a low-load situation, the node receiving the originating message should do all the work in the workflow. In a high-load situation, the node receiving the originating message should farm out work to the other nodes. EC2 will let you set up a nice load balancer, but the option to balance load between nodes OR within a node needs a bit more thought - i.e. when a cluster node receives an event published message, it can call the next service in the workflow either by remotely sending a WCF service request to the load balanced URL, or by executing the code locally.&lt;/p&gt;
		&lt;p&gt;This is actually very simple, and I've published a working example on my github code gallery: &lt;a title="DistributedServiceSample" href="https://github.com/sixeyed/codegallery/tree/master/DistributedServiceSample" target="_blank"&gt;DistributedServiceSample&lt;/a&gt;. In the sample, all service calls in the central node are run through a generic service invoker:&lt;/p&gt;
		&lt;font face="Consolas" size="1"&gt;
				&lt;font face="Consolas" size="1"&gt;
						&lt;p&gt;
						&lt;/p&gt;
				&lt;/font&gt;
		&lt;/font&gt;
		&lt;font size="2"&gt;
				&lt;font color="#2b91af" face="Consolas"&gt;
						&lt;font color="#2b91af" face="Consolas"&gt;
								&lt;font color="#2b91af" face="Consolas"&gt;Service&lt;/font&gt;
						&lt;/font&gt;
				&lt;/font&gt;
				&lt;font face="Consolas"&gt;
						&lt;font face="Consolas"&gt;.Execute&amp;lt;&lt;/font&gt;
				&lt;/font&gt;
				&lt;font color="#2b91af" face="Consolas"&gt;
						&lt;font color="#2b91af" face="Consolas"&gt;
								&lt;font color="#2b91af" face="Consolas"&gt;IComputeService&lt;/font&gt;
						&lt;/font&gt;
				&lt;/font&gt;
		&lt;/font&gt;
		&lt;font face="Consolas" size="1"&gt;
				&lt;font face="Consolas" size="1"&gt;
						&lt;font size="2"&gt;&amp;gt;(svc =&amp;gt; svc.Compute(jobId));&lt;/font&gt;
						&lt;p&gt;
						&lt;/p&gt;
				&lt;/font&gt;
		&lt;/font&gt;The invoker either builds a WCF client proxy, or instantiates the service implementation locally, and makes the call. In the sample the logic for deciding whether to go remote or local is done in config, but this could be worked into something more complex based on current capacity etc. The sample also allows the invoker to decide whether to make a synchronous call, or farm the work out to an async task (again, through config). 
&lt;p&gt;&lt;strong&gt;Dependencies&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Dynamically building a WCF client proxy is very simple, there are no dependencies outside .NET and you can leave all the endpoint configuration to the normal &amp;lt;serviceModel&amp;gt; config section. When the central node is in remote mode, it gets the proxy like this:&lt;/p&gt;&lt;font face="Consolas" size="1"&gt;&lt;font face="Consolas" size="1"&gt;&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font size="2"&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;var&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font face="Consolas"&gt; factory = &lt;/font&gt;&lt;/font&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;&lt;font color="#0000ff" face="Consolas"&gt;new&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font face="Consolas"&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#2b91af" face="Consolas"&gt;&lt;font color="#2b91af" face="Consolas"&gt;&lt;font color="#2b91af" face="Consolas"&gt;ChannelFactory&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas"&gt;&lt;font face="Consolas"&gt;&amp;lt;TService&amp;gt;(&lt;/font&gt;&lt;/font&gt;&lt;font color="#a31515" face="Consolas"&gt;&lt;font color="#a31515" face="Consolas"&gt;&lt;font color="#a31515" face="Consolas"&gt;"*"&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="1"&gt;&lt;font face="Consolas" size="1"&gt;&lt;font size="2"&gt;);&lt;/font&gt;&lt;br /&gt;&lt;font size="2"&gt;service = factory.CreateChannel();&lt;/font&gt;&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;(The asterisk tells WCF to pull the client endpoint and binding from config based on the contract name and assumes there is only one client entry per contract). 
&lt;p&gt;When in local mode, it's a little bit more involved to do it dynamically. In the sample I have a marker interface (&lt;strong&gt;IService&lt;/strong&gt;) to denote a service contract. In the service application startup I register all service implementations in an IoC container (a wrapper around Unity), and then the central node gets the service like this:&lt;/p&gt;&lt;font face="Consolas" size="1"&gt;&lt;font face="Consolas" size="1"&gt;&lt;p&gt;&lt;font size="2"&gt;service = &lt;/font&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;&lt;font color="#2b91af" face="Consolas"&gt;&lt;font color="#2b91af" face="Consolas"&gt;&lt;font color="#2b91af" face="Consolas" size="2"&gt;Container&lt;/font&gt;&lt;/font&gt;&lt;/font&gt;&lt;font face="Consolas" size="1"&gt;&lt;font face="Consolas" size="1"&gt;&lt;font size="2"&gt;.Get&amp;lt;TService&amp;gt;();&lt;/font&gt;&lt;p&gt;&lt;/p&gt;&lt;/font&gt;&lt;/font&gt;The actual method call on the service is done through functions or actions (depending on whether the service returns a response), so it's all typesafe. 
&lt;p&gt;&lt;strong&gt;Running the sample&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;Build the sample locally, and open &lt;a href="http://localhost/DistributedServiceSample.Services/JobService.svc"&gt;http://localhost/DistributedServiceSample.Services/JobService.svc&lt;/a&gt; in WCFStorm or soapUI. Call &lt;em&gt;CreateJob&lt;/em&gt; with whatever parameter you like, and you will see output similar to this in DebugView:&lt;/p&gt;&lt;p&gt;&lt;font face="Courier New" size="2"&gt;JobService.CreateJob called with Name: fhwfiy&lt;br /&gt;Service.GetExecutionMode using *Synchronous* for service: DistributedServiceSample.Contracts.Services.IJobService&lt;br /&gt;Service.GetServiceLocation using *Remote* for service: DistributedServiceSample.Contracts.Services.IJobService&lt;br /&gt;JobService.SaveJob called with jobId: fhwfiy&lt;br /&gt;Service.GetExecutionMode using *AsynchronousIgnoreResponse* for service: DistributedServiceSample.Contracts.Services.IComputeService&lt;br /&gt;Service.GetServiceLocation using *Local* for service: DistributedServiceSample.Contracts.Services.IComputeService&lt;br /&gt;ComputeService.Compute called with jobId: 621849676&lt;/font&gt;&lt;/p&gt;&lt;p&gt;The workflow is that &lt;em&gt;CreateJob&lt;/em&gt; triggers a &lt;em&gt;SaveJob&lt;/em&gt; call, which in turn triggers a &lt;em&gt;Compute&lt;/em&gt; call. The service decides whether each downstream call will be made locally or remotely, synchronously or asynchronously based on the contents of the &lt;font face="Courier New" size="2"&gt;&amp;lt;distributedservicesample.invoker&amp;gt;&lt;/font&gt; section in Web.config. &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Extensions&lt;/strong&gt;&lt;/p&gt;&lt;p&gt;The obvious extension is to add an operation name to the config settings, so different operations within the same service can be executed in different ways, which is pretty straightforward. More complex is the idea of dynamically deciding whether to make a local or a remote call. The logic for the decision is all isolated, so it would be a case of swapping out the config stuff with some environment checks, so calls were made locally unless CPU or private bytes or current connections were above a threshold.&lt;/p&gt;&lt;p&gt; &lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/148053.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2011/12/16/distributing-wcf-service-load-vertically-as-well-as-horizontally.aspx</guid>
            <pubDate>Fri, 16 Dec 2011 07:52:12 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/148053.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2011/12/16/distributing-wcf-service-load-vertically-as-well-as-horizontally.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/148053.aspx</wfw:commentRss>
        </item>
        <item>
            <title>The value of a Diagnostics service</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2011/12/12/the-value-of-a-diagnostics-service.aspx</link>
            <description>For an integration solution with lots of dependencies, it's difficult to definitively state that everything is wired up correctly and that all components in the stack are working. A while ago, &lt;a target="_blank" title="Michael Stephenson" href="http://geekswithblogs.net/michaelstephenson/Default.aspx"&gt;Michael Stephenson&lt;/a&gt; proposed having a diagnostic service in a solution as a quick way of verifying that a given environment was working, end-to-end. Initially I was sceptical, on the grounds that there shouldn't be any code in a solution which isn't directly solving a business problem, but having tried it out I've been won over.&lt;br /&gt;&lt;br /&gt;We now have a dedicated suite of diagnostics services which check a whole range of stuff, including availability of all the downstream services, the in-process and out-of-process caches, and the accessibility of BizTalk file drops. We also include environmental stuff like the version number of the solution, machine name, server date and time, IP addresses etc. And we have a rolled-up service which gives us a green or red status for the solution.&lt;br /&gt;&lt;br /&gt;For devs and technical owners of the solution, this gives us a very detailed view of the health of the stack, but we have REST endpoints for the general healthcheck services, and we now use these all over the place:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;in our automated deployment process, we send an email after an environment had been deployed. That email contains the output of the healthcheck service, so we can tell if a deployment was successful;&lt;/li&gt;&lt;li&gt;the REST URLs are published to the team, so testers and service consumers can quickly check if the environment is operational before starting work on a release;&lt;/li&gt;&lt;li&gt;we have something like 10 environments which are all catalogued, and the REST URL for the version number service means we're not manually updating version numbers in the catalogue after a release;&lt;/li&gt;&lt;li&gt;we have nightly releases of the integration solution and the downstream services, so we have simple PowerShell script run from a Windows schedule every morning, which checks the output of the REST services and emails the team with the test environment status;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;calling the diagnostic service warms up the server app pool, and all the app pools of the downstream services, so the scheduled job warms everything up after a recycle.&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;With this simple stuff in place we're saving a bunch of time investigating problems which turn out not to be problems in the integration solution, and the offshore test team can quickly see if there are problems with the stack before investing time on tests. Highly recommended.&lt;br /&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/148009.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2011/12/12/the-value-of-a-diagnostics-service.aspx</guid>
            <pubDate>Mon, 12 Dec 2011 09:18:38 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/148009.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2011/12/12/the-value-of-a-diagnostics-service.aspx#feedback</comments>
            <slash:comments>1</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/148009.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Extension method for neatly checking a type implements an interface</title>
            <category>Code Snippet</category>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2011/10/04/extension-method-for-neatly-checking-a-type-implements-an-interface.aspx</link>
            <description>&lt;p&gt;I've never liked having to pass a string to &lt;strong&gt;Type.GetInterface() &lt;/strong&gt;to check if a type implements an interface.&lt;/p&gt;
&lt;p&gt;This extension method to the Type class lets you check more neatly with a generic: &lt;/p&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;    &lt;span style="color: gray"&gt;///&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;    &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Extension methods for the &lt;/span&gt;&lt;span style="color: gray"&gt;&amp;lt;see cref="Type"/&amp;gt;&lt;/span&gt;&lt;span style="color: green"&gt; class.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;    &lt;span style="color: gray"&gt;///&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&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;class&lt;/span&gt; &lt;span style="color: #2b91af"&gt;TypeExtensions&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;    {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        &lt;span style="color: gray"&gt;///&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        &lt;span style="color: gray"&gt;///&lt;/span&gt;&lt;span style="color: green"&gt; Returns whether the type implements the given interface&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        &lt;span style="color: gray"&gt;///&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        &lt;span style="color: gray"&gt;///&amp;lt;param name="value"&amp;gt;&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        &lt;span style="color: gray"&gt;///&amp;lt;returns&amp;gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&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;bool&lt;/span&gt; ImplementsInterface&amp;lt;T&amp;gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt; &lt;span style="color: #2b91af"&gt;Type&lt;/span&gt; type)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            &lt;span style="color: blue"&gt;var&lt;/span&gt; implements = &lt;span style="color: blue"&gt;false&lt;/span&gt;;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            &lt;span style="color: blue"&gt;if&lt;/span&gt; (&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(T).IsInterface)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;                &lt;span style="color: blue"&gt;var&lt;/span&gt; interfaceName = &lt;span style="color: blue"&gt;typeof&lt;/span&gt;(T).Name;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;                implements = (type.GetInterface(interfaceName) != &lt;span style="color: blue"&gt;null&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            &lt;span style="color: blue"&gt;return&lt;/span&gt; implements;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;    }&lt;/span&gt;&lt;/div&gt;
&lt;p&gt; Usage:&lt;/p&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;    &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.IsTrue(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Stub&lt;/span&gt;).ImplementsInterface&amp;lt;&lt;span style="color: #2b91af"&gt;IStub&lt;/span&gt;&amp;gt;());&lt;/span&gt;&lt;/div&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/147174.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2011/10/04/extension-method-for-neatly-checking-a-type-implements-an-interface.aspx</guid>
            <pubDate>Tue, 04 Oct 2011 09:00:09 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/147174.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2011/10/04/extension-method-for-neatly-checking-a-type-implements-an-interface.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/147174.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Uncaught exceptions in Task threads will kill IIS - even with WCF error handling</title>
            <category>Annoying problems</category>
            <category>IIS</category>
            <category>.NET 4.0</category>
            <category>WCF</category>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2011/09/30/uncaught-exceptions-in-task-threads-will-kill-iis---even-with-wcf-error-handling.aspx</link>
            <description>&lt;p&gt;Yes, all unhandled exceptions will kill the IIS worker process, but in WCF you can tag an &lt;strong&gt;IErrorHandler &lt;/strong&gt;onto your service behavior and all unhandled exceptions will be neatly taken care of. Unless that exception is thrown from a factory task, in which case the error handler is bypassed and the worker process is killed. &lt;/p&gt;
&lt;p&gt;So this code:&lt;/p&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        &lt;span style="color: blue"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af"&gt;ServiceResponse&lt;/span&gt; OnBoardClient(&lt;span style="color: #2b91af"&gt;Client&lt;/span&gt; newClient)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            &lt;span style="color: blue"&gt;if&lt;/span&gt; (IsValid(newClient))&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;                &lt;span style="color: blue"&gt;var&lt;/span&gt; client = newClient;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;                &lt;span style="color: #2b91af"&gt;Task&lt;/span&gt;.Factory.StartNew(() =&amp;gt; OnBoardClientInternal(client));&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            &lt;span style="color: green"&gt;//etc.            &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt; &lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; OnBoardClientInternal(&lt;span style="color: #2b91af"&gt;Client&lt;/span&gt; newClient)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            &lt;span style="color: blue"&gt;var&lt;/span&gt; zero = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            &lt;span style="color: blue"&gt;var&lt;/span&gt; dbz = 10 / zero;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;- will throw a &lt;strong&gt;System.AggregateException&lt;/strong&gt; in the &lt;em&gt;TaskExceptionHolder.Finalize()&lt;/em&gt; method and it will take down the IIS worker process with it (as described in &lt;a href="http://stackoverflow.com/questions/5054750/task-factory-startnew-with-uncaught-exceptions-kills-w3wp"&gt;this StackOverflow question&lt;/a&gt;). Of course this also kills any other connections being handled by the worker process.&lt;br /&gt;
&lt;br /&gt;
This is in-line with the &lt;a href="http://support.microsoft.com/kb/911816"&gt;expected behaviour for ASP.NET applications&lt;/a&gt;:&lt;br /&gt;
&lt;br /&gt;
&lt;em&gt;"Exceptions that occur in the context of a request do not cause the worker process to end. However, unhandled exceptions outside the context of a request, such as exceptions on a timer thread or in a callback function, cause the worker process to end".&lt;/em&gt;&lt;br /&gt;
&lt;br /&gt;
So the WCF error handler only applies within the request-response context, and within task code you need to explicitly add error handling:&lt;br /&gt;
&lt;br /&gt;
&lt;code&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        &lt;span style="color: blue"&gt;private&lt;/span&gt; &lt;span style="color: blue"&gt;static&lt;/span&gt; &lt;span style="color: blue"&gt;void&lt;/span&gt; OnBoardClientInternal(&lt;span style="color: #2b91af"&gt;Client&lt;/span&gt; newClient)&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            &lt;span style="color: blue"&gt;try&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;                &lt;span style="color: blue"&gt;var&lt;/span&gt; zero = 0;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;                &lt;span style="color: blue"&gt;var&lt;/span&gt; dbz = 10 / zero;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            &lt;span style="color: blue"&gt;catch&lt;/span&gt; (&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt; ex)&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            {&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;                &lt;span style="color: green"&gt;//etc.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;            }&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="font-size: 8pt; font-family: Consolas"&gt;        }&lt;/span&gt;&lt;/div&gt;
&lt;p&gt; - which can call into your error handler's &lt;em&gt;HandleError &lt;/em&gt;method (if your scenario warrants consistent error handling).&lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/147117.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2011/09/30/uncaught-exceptions-in-task-threads-will-kill-iis---even-with-wcf-error-handling.aspx</guid>
            <pubDate>Fri, 30 Sep 2011 10:42:26 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/147117.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2011/09/30/uncaught-exceptions-in-task-threads-will-kill-iis---even-with-wcf-error-handling.aspx#feedback</comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/147117.aspx</wfw:commentRss>
        </item>
        <item>
            <title>Setting up a remote git repository on your ReadyNAS</title>
            <link>http://geekswithblogs.net/EltonStoneman/archive/2011/06/09/setting-up-a-remote-git-repository-on-your-readynas.aspx</link>
            <description>&lt;p&gt;&lt;big&gt;&lt;span style="font-family:Calibri"&gt;More of a note-to-self,&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;but may be useful to other ReadyNAS users who aren’t quite at home with Linux.&lt;/span&gt;&lt;span style="font-family:Calibri"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/big&gt;&lt;/p&gt;
&lt;p&gt;&lt;big&gt;&lt;span style="font-family:Calibri"&gt;As I’m doing a lot of coding with different environments, and I want easy SCM, git is a fine choice. Git runs through IP addresses, so I can access remote servers inside VMs without any weird config needed.&lt;/span&gt; &lt;span style="font-family: Calibri;"&gt;It integrates natively with XCode for iOS programming, and &lt;/span&gt;&lt;/big&gt;&lt;span style="font-family:Calibri"&gt;&lt;a href="http://code.google.com/p/msysgit/"&gt;&lt;big&gt;msysgit&lt;/big&gt;&lt;/a&gt;&lt;big&gt;  is a simple UI for Windows (there is also a &lt;/big&gt;&lt;a href="http://code.google.com/p/gitextensions/"&gt;&lt;big&gt;VS extension for git&lt;/big&gt;&lt;/a&gt;&lt;/span&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt;). &lt;/span&gt;&lt;/big&gt;&lt;/p&gt;
&lt;p&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt;Setting up git on the ReadyNAS is straightforward, but there are a couple of fiddly steps. First of all install the &lt;/span&gt;&lt;/big&gt;&lt;span style="font-family:Calibri"&gt;&lt;a href="http://www.readynas.com/forum/viewtopic.php?f=47&amp;amp;t=35533"&gt;&lt;big&gt;git add-on&lt;/big&gt;&lt;/a&gt;&lt;/span&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt; and get it configured correctly:&lt;/span&gt;&lt;span style="font-family:Calibri"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/big&gt;&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt;Install the&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;latest version of the &lt;/span&gt;&lt;/big&gt;&lt;span style="font-family:Calibri"&gt;&lt;a href="http://readynasfreeware.org/projects/nas-gitscm/file"&gt;&lt;big&gt;community git add-on&lt;/big&gt;&lt;/a&gt;&lt;/span&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt; (download the .bin file and upload as a local update through FrontView, as with any other packages).&lt;/span&gt;&lt;/big&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt;Enable root SSH access with the &lt;/span&gt;&lt;/big&gt;&lt;span style="font-family:Calibri"&gt;&lt;a href="http://blog.epdoc.com/2009/11/ssh-on-readynas-nv.html"&gt;&lt;big&gt;ReadyNAS add-on&lt;/big&gt;&lt;/a&gt;&lt;/span&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span style="font-family:Calibri"&gt;Sign on to SSH as root: &lt;/span&gt;&lt;strong&gt;&lt;span lang="EN-US" style="font-family:Calibri;mso-bidi-font-family:&amp;#xD;&amp;#xA;    Helvetica;mso-ansi-language:EN-US"&gt;ssh root@your_nas_ip&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Calibri"&gt;&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;(using your FrontView admin password)&lt;/span&gt;&lt;/big&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt;Open the remote logon script for SSH -&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;/big&gt;&lt;span style="font-family:Calibri"&gt;&lt;a href="http://www.cs.colostate.edu/helpdocs/vi.html"&gt;&lt;big&gt;text editor vi&lt;/big&gt;&lt;/a&gt;&lt;/span&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt; will get you there: &lt;strong&gt;vi .bashrc&lt;/strong&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;/big&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span style="font-family:Calibri"&gt;Insert a new line in the script to add the folder with the git binaries to the path for remote logins:&lt;/span&gt;&lt;strong&gt;&lt;span style="font-family: Calibri;"&gt; export PATH=PATH:/opt/rfw/bin&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-family:Calibri"&gt;&lt;br /&gt;
    &lt;/span&gt;&lt;/big&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;big&gt;&lt;span style="font-family:Calibri"&gt;To create &amp;amp; populate your remote repository:&lt;/span&gt;&lt;span style="font-family:Calibri"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/big&gt;&lt;/p&gt;
&lt;ol&gt;
    &lt;li&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt;Sign on to SSH as root&lt;/span&gt;&lt;span style="font-family:Calibri"&gt;: &lt;/span&gt;&lt;strong&gt;&lt;span lang="EN-US" style="font-family:Calibri;mso-bidi-font-family:&amp;#xD;&amp;#xA;    Helvetica;mso-ansi-language:EN-US"&gt;ssh root@your_nas_ip&lt;/span&gt;&lt;/strong&gt;&lt;/big&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span style="font-family:Calibri"&gt;Create the folder for your repository:&lt;span style="mso-spacerun:yes"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;strong&gt;&lt;span lang="EN-US" style="font-family:Calibri;mso-bidi-font-family:Helvetica;&amp;#xD;&amp;#xA;    mso-ansi-language:EN-US"&gt;mkdir /opt/git/what_ever &amp;amp;&amp;amp; cd /opt/git/what_ever&lt;/span&gt;&lt;/strong&gt;&lt;/big&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span lang="EN-US" style="font-family:Calibri;&amp;#xD;&amp;#xA;    mso-bidi-font-family:Helvetica;mso-ansi-language:EN-US"&gt;Initialise the repository:&lt;/span&gt;&lt;strong&gt;&lt;span lang="EN-US" style="font-family: Calibri;"&gt; git – bare init&lt;/span&gt;&lt;/strong&gt;&lt;/big&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span lang="EN-US" style="font-family:Calibri;&amp;#xD;&amp;#xA;    mso-bidi-font-family:Helvetica;mso-ansi-language:EN-US"&gt;Exit SSH (&lt;strong&gt;exit&lt;/strong&gt;)&lt;/span&gt;&lt;/big&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt;Navigate to the local git project folder: &lt;strong&gt;cd projects/etc&lt;/strong&gt;&lt;/span&gt;&lt;/big&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span style="font-family:Calibri"&gt;Add the remote repo: &lt;/span&gt;&lt;strong&gt;&lt;span lang="EN-US" style="font-family:Calibri;mso-bidi-font-family:&amp;#xD;&amp;#xA;    Helvetica;mso-ansi-language:EN-US"&gt;git remote add origin ssh://root@your_nas_ip/opt/git/what_ever&lt;/span&gt;&lt;/strong&gt;&lt;/big&gt;&lt;/li&gt;
    &lt;li&gt;&lt;big&gt;&lt;span lang="EN-US" style="font-family: Calibri;"&gt;Populate the remote repository: &lt;/span&gt;&lt;strong&gt;&lt;span lang="EN-US" style="font-family: Calibri;"&gt;git push origin master&lt;/span&gt;&lt;/strong&gt;&lt;span lang="EN-US" style="font-family:Calibri;&amp;#xD;&amp;#xA;    mso-bidi-font-family:Helvetica;mso-ansi-language:EN-US"&gt; (using your admin password).&lt;/span&gt;&lt;/big&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt;All done, and you can push, pull and clone to your NAS drive as if it were github. Navigate to local Web interface (&lt;/span&gt;&lt;/big&gt;&lt;span style="font-family:Calibri"&gt;&lt;a href="https://your_nas_ip/gitweb/gitweb.cgi"&gt;&lt;big&gt;https://your_nas_ip/gitweb/gitweb.cgi&lt;/big&gt;&lt;/a&gt;&lt;/span&gt;&lt;big&gt;&lt;span style="font-family: Calibri;"&gt;) and you should see your new project listed, and you can browse all the previous commits. &lt;/span&gt;&lt;/big&gt;&lt;/p&gt;
&lt;p class="MsoListParagraphCxSpLast" style="text-indent: -18pt;"&gt;&lt;big&gt; &lt;/big&gt;&lt;/p&gt;
&lt;p&gt;&lt;big&gt; &lt;/big&gt;&lt;/p&gt; &lt;img src="http://geekswithblogs.net/EltonStoneman/aggbug/145801.aspx" width="1" height="1" /&gt;</description>
            <dc:creator>Elton Stoneman</dc:creator>
            <guid>http://geekswithblogs.net/EltonStoneman/archive/2011/06/09/setting-up-a-remote-git-repository-on-your-readynas.aspx</guid>
            <pubDate>Thu, 09 Jun 2011 21:29:48 GMT</pubDate>
            <wfw:comment>http://geekswithblogs.net/EltonStoneman/comments/145801.aspx</wfw:comment>
            <comments>http://geekswithblogs.net/EltonStoneman/archive/2011/06/09/setting-up-a-remote-git-repository-on-your-readynas.aspx#feedback</comments>
            <slash:comments>6</slash:comments>
            <wfw:commentRss>http://geekswithblogs.net/EltonStoneman/comments/commentRss/145801.aspx</wfw:commentRss>
        </item>
    </channel>
</rss>
