<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Garry Pilkington</title><link>http://weblogs.asp.net/garrypilkington/default.aspx</link><description>&lt;br/&gt;Application Developer&lt;br/&gt;Liverpool, UK</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP1 (Build: 20510.895)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/GarrysnetBlog" /><feedburner:info uri="garrysnetblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>GarrysnetBlog</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><title>Web Site Performance and Assembly Versioning – Part 3 Versioning Combined Files Using Mercurial</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/2zwRbnkHawk/web-site-performance-and-assembly-versioning-part-3-versioning-combined-files-using-mercurial.aspx</link><pubDate>Wed, 30 May 2012 10:56:32 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8547661</guid><dc:creator>capgpilk</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=8547661</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=8547661</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2012/05/30/web-site-performance-and-assembly-versioning-part-3-versioning-combined-files-using-mercurial.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://weblogs.asp.net/garrypilkington/archive/2012/03/19/web-site-performance-and-assembly-versioning.aspx"&gt;Minification and Concatination of JavaScript and CSS Files&lt;/a&gt;&lt;em&gt;      &lt;br /&gt;&lt;/em&gt;&lt;a href="http://weblogs.asp.net/garrypilkington/default.aspx" target="_blank"&gt;Versioning Combined Files Using Subversion&lt;/a&gt;&lt;em&gt;      &lt;br /&gt;&lt;/em&gt;Versioning Combined Files Using Mercurial – &lt;em&gt;this post&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;I have worked on a project recently where there was a need to version the system (library dll, css and javascript files) by date and Mercurial revision number. This was in the format:-&lt;/p&gt;  &lt;p&gt;0.12.524.407&lt;/p&gt;  &lt;p&gt;{major}.{year}.{month}{date}.{mercurial revision}&lt;/p&gt;  &lt;p&gt;Each time there is an internal build using the CI server, it would label the files using this format. When it came time to do a major release, it became v1.{year}.{month}{date}.{mercurial revision}, with each public release having a major version increment.&lt;/p&gt;  &lt;p&gt;Also as a requirement, each assembly also had to have a new GUID on each build.&lt;/p&gt;  &lt;p&gt;So like in previous posts, we need to edit the csproj file, and add a couple of Default targets.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #800000"&gt;xml&lt;/span&gt; &lt;span style="color: #ff0000"&gt;version&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;encoding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;utf-8&amp;quot;&lt;/span&gt;?&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Project&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ToolsVersion&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;4.0&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;DefaultTargets&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Hg-Revision;AssemblyInfo;Build&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;xmlns&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;http://schemas.microsoft.com/developer/msbuild/2003&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;PropertyGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;Right below the closing tag of the entire project we add our two targets, the first is to get the Mercurial revision number. We first need to import the tasks for MSBuild which can be downloaded from &lt;a href="http://msbuildhg.codeplex.com/"&gt;http://msbuildhg.codeplex.com/&lt;/a&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Import&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Project&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;..\Tools\MSBuild.Mercurial\MSBuild.Mercurial.Tasks&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Target&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Hg-Revision&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;HgVersion&lt;/span&gt; &lt;span style="color: #ff0000"&gt;LocalPath&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(MSBuildProjectDirectory)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Timeout&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;5000&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;LibraryLocation&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;C:\TortoiseHg\&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;   &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Output&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TaskParameter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Revision&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PropertyName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Revision&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;HgVersion&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Message&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Last revision from HG: $(Revision)&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;Target&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;


With the main Mercurial files being located at c:\TortoiseHg 

&lt;p&gt;To get a valid GUID we need to escape from the csproj markup and call some c# code which we put in a property group for later reference.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;PropertyGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;GuidGenFunction&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;!&lt;/span&gt;[CDATA[ &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; public static string ScriptMain() { &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt; return System.Guid.NewGuid().ToString().ToUpper(); &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; } &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; ]]&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;GuidGenFunction&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;PropertyGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Now we add in our target for generating the GUID.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;Target Name=&lt;span style="color: #006080"&gt;&amp;quot;AssemblyInfo&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;     &amp;lt;Script Language=&lt;span style="color: #006080"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt; Code=&lt;span style="color: #006080"&gt;&amp;quot;$(GuidGenFunction)&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;       &amp;lt;Output TaskParameter=&lt;span style="color: #006080"&gt;&amp;quot;ReturnValue&amp;quot;&lt;/span&gt; PropertyName=&lt;span style="color: #006080"&gt;&amp;quot;NewGuid&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;     &amp;lt;/Script&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;     &amp;lt;Time Format=&lt;span style="color: #006080"&gt;&amp;quot;yy&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt;       &amp;lt;Output TaskParameter=&lt;span style="color: #006080"&gt;&amp;quot;FormattedTime&amp;quot;&lt;/span&gt; PropertyName=&lt;span style="color: #006080"&gt;&amp;quot;year&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt;     &amp;lt;/Time&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt;     &amp;lt;Time Format=&lt;span style="color: #006080"&gt;&amp;quot;Mdd&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt;       &amp;lt;Output TaskParameter=&lt;span style="color: #006080"&gt;&amp;quot;FormattedTime&amp;quot;&lt;/span&gt; PropertyName=&lt;span style="color: #006080"&gt;&amp;quot;daymonth&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt;     &amp;lt;/Time&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt;     &amp;lt;AssemblyInfo CodeLanguage=&lt;span style="color: #006080"&gt;&amp;quot;CS&amp;quot;&lt;/span&gt; OutputFile=&lt;span style="color: #006080"&gt;&amp;quot;Properties\AssemblyInfo.cs&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt;         AssemblyTitle=&lt;span style="color: #006080"&gt;&amp;quot;name&amp;quot;&lt;/span&gt; AssemblyDescription=&lt;span style="color: #006080"&gt;&amp;quot;description&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt;         AssemblyCompany=&lt;span style="color: #006080"&gt;&amp;quot;none&amp;quot; AssemblyProduct=&amp;quot;&lt;/span&gt;product&lt;span style="color: #006080"&gt;&amp;quot; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt;         AssemblyCopyright=&amp;quot;&lt;/span&gt;Copyright ©&lt;span style="color: #006080"&gt;&amp;quot; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt;         ComVisible=&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot; CLSCompliant=&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;&lt;span style="color: #006080"&gt;&amp;quot; Guid=&amp;quot;&lt;/span&gt;$(NewGuid)&lt;span style="color: #006080"&gt;&amp;quot; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum16"&gt;  16:&lt;/span&gt;         AssemblyVersion=&amp;quot;&lt;/span&gt;$(Major).$(year).$(daymonth).$(Revision)&lt;span style="color: #006080"&gt;&amp;quot; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum17"&gt;  17:&lt;/span&gt;         AssemblyFileVersion=&amp;quot;&lt;/span&gt;$(Major).$(year).$(daymonth).$(Revision)&amp;quot; /&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum18"&gt;  18:&lt;/span&gt;   &amp;lt;/Target&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;So this will give use an AssemblyInfo.cs file like this just prior to calling the Build task:-&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Reflection;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Runtime.CompilerServices;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Runtime.InteropServices;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum5"&gt;   5:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum6"&gt;   6:&lt;/span&gt; [assembly: AssemblyTitle(&lt;span style="color: #006080"&gt;&amp;quot;name&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum7"&gt;   7:&lt;/span&gt; [assembly: AssemblyDescription(&lt;span style="color: #006080"&gt;&amp;quot;description&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum8"&gt;   8:&lt;/span&gt; [assembly: AssemblyCompany(&lt;span style="color: #006080"&gt;&amp;quot;none&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum9"&gt;   9:&lt;/span&gt; [assembly: AssemblyProduct(&lt;span style="color: #006080"&gt;&amp;quot;product&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum10"&gt;  10:&lt;/span&gt; [assembly: AssemblyCopyright(&lt;span style="color: #006080"&gt;&amp;quot;Copyright ©&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum11"&gt;  11:&lt;/span&gt; [assembly: ComVisible(&lt;span style="color: #0000ff"&gt;false&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum12"&gt;  12:&lt;/span&gt; [assembly: CLSCompliant(&lt;span style="color: #0000ff"&gt;true&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum13"&gt;  13:&lt;/span&gt; [assembly: Guid(&lt;span style="color: #006080"&gt;&amp;quot;9C2C130E-40EF-4A20-B7AC-A23BA4B5F2B7&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum14"&gt;  14:&lt;/span&gt; [assembly: AssemblyVersion(&lt;span style="color: #006080"&gt;&amp;quot;0.12.524.407&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum15"&gt;  15:&lt;/span&gt; [assembly: AssemblyFileVersion(&lt;span style="color: #006080"&gt;&amp;quot;0.12.524.407&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;Therefore giving us the correct version for the assembly. This can be referenced within your project whether web or Windows based like this:-&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; AppVersion()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; Assembly.GetExecutingAssembly().GetName().Version.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum4"&gt;   4:&lt;/span&gt;  }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;As mentioned in previous posts in this series, you can label css and javascript files using this version number and the GetAssemblyIdentity task from the main MSBuild task library build into the .Net framework.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;GetAssemblyIdentity&lt;/span&gt; &lt;span style="color: #ff0000"&gt;AssemblyFiles&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;bin\TheAssemblyFile.dll&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;  &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Output&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TaskParameter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Assemblies&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ItemName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;MyAssemblyIdentities&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;GetAssemblyIdentity&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Then use this to write out the files:-&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;WriteLinestoFile&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;File&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Client\site-style-%(MyAssemblyIdentities.Version).combined.min.css&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #606060" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;Lines&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;@(CSSLinesSite)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Overwrite&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8547661" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/2zwRbnkHawk" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Continuous+Integration/default.aspx">Continuous Integration</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Tools/default.aspx">Tools</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2012/05/30/web-site-performance-and-assembly-versioning-part-3-versioning-combined-files-using-mercurial.aspx</feedburner:origLink></item><item><title>Web Site Performance and Assembly Versioning – Part 2 Versioning Combined Files Using Subversion</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/W5DDQv3R8Fs/web-site-performance-and-assembly-versioning-part-2-versioning-combined-files-using-subversion.aspx</link><pubDate>Tue, 03 Apr 2012 13:56:24 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8374453</guid><dc:creator>capgpilk</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=8374453</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=8374453</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2012/04/03/web-site-performance-and-assembly-versioning-part-2-versioning-combined-files-using-subversion.aspx#comments</comments><description>&lt;p&gt;Ok so it took a while to post this second part. Many apologies, we had a big roll out of a new platform at work and many things had to get sidelined.&lt;/p&gt;  &lt;p&gt;So this is the second part in a short series of website performance and using versioning to help improve it.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/garrypilkington/archive/2012/03/19/web-site-performance-and-assembly-versioning.aspx" target="_blank"&gt;Minification and Concatination of JavaScript and CSS Files&lt;/a&gt;&lt;em&gt;     &lt;br /&gt;&lt;/em&gt;Versioning Combined Files Using Subversion – &lt;em&gt;this post     &lt;br /&gt;&lt;/em&gt;Versioning Combined Files Using Mercurial – &lt;em&gt;published shortly&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;In the previous post we used AjaxMin to shrink js and css files then concatenated them into one file each which had the file name of site-script.combined.min.js and site-style.combined.min.css.&lt;/p&gt;  &lt;p&gt;These file names are fine, but you can configure IIS 7 to cache these static files and so lower the amount of data transferred between server and client. This is done by editing the response headers in IIS.&lt;/p&gt;  &lt;p&gt;1. In IIS7 Manager, choose the directory where these files are located and select HTTP Response Headers.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/1_24CC2DAA.png"&gt;&lt;img title="1" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="371" alt="1" src="http://weblogs.asp.net/blogs/garrypilkington/1_thumb_0DA343DD.png" width="528" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;2. Check the Expire Web Content and set a time period well into the future.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/2_4C975529.png"&gt;&lt;img title="2" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="235" alt="2" src="http://weblogs.asp.net/blogs/garrypilkington/2_thumb_0308072C.png" width="351" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;3. When refreshing the web page, the server will respond with HTTP 304 forcing the browser to retrieve the file from its cache.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/3_67660BE6.png"&gt;&lt;img title="3" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="51" alt="3" src="http://weblogs.asp.net/blogs/garrypilkington/3_thumb_6FE96B30.png" width="410" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;4. As can be seen in FireBug, the Cache-Control header has a max age of 31536000 seconds which equates to 365 days.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/4_54476FEB.png"&gt;&lt;img title="4" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="200" alt="4" src="http://weblogs.asp.net/blogs/garrypilkington/4_thumb_0AB821EE.png" width="444" border="0" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160; &lt;/p&gt;  &lt;p&gt;The server will always send this HTTP 304 message unless the file changes forcing it to send new content. To help force this we can change the file name based on the latest build using the SVN revision number in the filename. So we have lowered data transfer on content that hasn’t changed, but forced it to be sent when you have made a change to the css or js files.&lt;/p&gt;  &lt;p&gt;Now to get the SVN revision number in to the file name.&lt;/p&gt;  &lt;p&gt;1. Import the MSBuildCommunityTasks targets which can be &lt;a href="http://msbuildtasks.tigris.org/" target="_blank"&gt;dowloaded from here&lt;/a&gt;.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Import&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Project&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(MSBuildExtensionsPath)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt; \MSBuildCommunityTasks&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt; \MSBuild.Community.Tasks.Targets&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;2. Edit the BeforeBuild target to call out to svn and get the latest revision&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;SvnVersion&lt;/span&gt; &lt;span style="color: #ff0000"&gt;LocalPath&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(MSBuildProjectDirectory)&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;ToolPath&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$(ProgramFiles)\VisualSVN Server\bin&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Output&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TaskParameter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Revision&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;PropertyName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Revision&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;SvnVersion&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;3. Set it to update the project AssemblyInfo.cs file for the svn revision.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;FileUpdate&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Files&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Properties\AssemblyInfo.cs&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;Regex&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;(\d+)\.(\d+)\.(\d+)\.(\d+)&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;ReplacementText&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;$1.$2.$3.$(Revision)&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;4. Now edit the AfterBuild target to get the full dll version. You could combine these two steps and just get the version from svn, I am working on one project that updates the AssemblyInfo file and another project that allows manual editing of the file, but needs that version within the file name; so I just combined the two for this post.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;MSBuild.ExtensionPack.Framework.Assembly&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;     TaskAction=&amp;quot;GetInfo&amp;quot; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;     NetAssembly=&amp;quot;$(OutputPath)\mydll.dll&amp;quot;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Output&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TaskParameter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;OutputItems&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ItemName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Info&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;MSBuild.ExtensionPack.Framework.Assembly&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum6" style="color: #606060"&gt;   6:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Message&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Version: %(Info.AssemblyVersion)&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum7" style="color: #606060"&gt;   7:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;Importance&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;High&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;5. Use this Info.AssemblyVersion to write out the combined css and js files as described in the last post.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;WriteLinestoFile&lt;/span&gt; &lt;span style="color: #ff0000"&gt;File&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Scripts\site-%(Info.AssemblyVersion).combined.min.js&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;Lines&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;@(JSLinesSite)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Overwrite&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;In the next post I will cover doing the same, but for a Mercurial repository.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8374453" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/W5DDQv3R8Fs" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Tools/default.aspx">Tools</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2012/04/03/web-site-performance-and-assembly-versioning-part-2-versioning-combined-files-using-subversion.aspx</feedburner:origLink></item><item><title>Web Site Performance and Assembly Versioning</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/HJ-HWt3t8Wc/web-site-performance-and-assembly-versioning.aspx</link><pubDate>Mon, 19 Mar 2012 12:58:43 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:8354486</guid><dc:creator>capgpilk</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=8354486</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=8354486</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2012/03/19/web-site-performance-and-assembly-versioning.aspx#comments</comments><description>&lt;p&gt;I originally wanted to write this post in one, but there is quite a large amount of information which can be broken down into different areas, so I am going to publish it in three posts.&lt;/p&gt;  &lt;p&gt;Minification and Concatination of JavaScript and CSS Files – &lt;em&gt;this post      &lt;br /&gt;&lt;/em&gt;&lt;a href="http://weblogs.asp.net/garrypilkington/archive/2012/04/03/web-site-performance-and-assembly-versioning-part-2-versioning-combined-files-using-subversion.aspx" target="_blank"&gt;Versioning Combined Files Using Subversion&lt;/a&gt;    &lt;br /&gt;Versioning Combined Files Using Mercurial – &lt;em&gt;published shortly&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Website Performance&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;There are many ways to improve web site performance, two areas are reducing the amount of data that is served up from the web server and reducing the number of files that are requested.&lt;/p&gt;  &lt;p&gt;Here I will outline the process of minimizing and concatenating your javascript and css files automatically at build time of your visual studio web site/ application.&lt;/p&gt;  &lt;p&gt;To edit the project file in Visual Studio, you need to first unload it by right clicking the project in Solution Explorer. I prefer to do this in a third party tool such as Notepad++ and save it there forcing VS to reload it each time I make a change as the whole process in Visual Studio can be a bit tedious.&lt;/p&gt;  &lt;p&gt;Now you have the project file, you will notice that it is an MSBuild project file.&lt;/p&gt;  &lt;p&gt;I am going to use a fantastic utility from &lt;a href="http://aspnet.codeplex.com/releases/view/34488" target="_blank"&gt;Microsoft called Ajax Minifier&lt;/a&gt;. This tool minifies both javascript and css.&lt;/p&gt;  &lt;p&gt;1. Import the tasks for AjaxMin choosing the location you installed to. I keep all third party utilities in a Tools directory within my solution structure and source control. This way I know I can get the entire solution from source control without worrying about what other tools I need to get the project to build locally.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/AjaxMin_16F6A4D6.jpg"&gt;&lt;img title="AjaxMin" style="border-top-width: 0px; display: inline; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="162" alt="AjaxMin" src="http://weblogs.asp.net/blogs/garrypilkington/AjaxMin_thumb_214A59E7.jpg" width="516" border="0" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Import&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Project&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;..\Tools\MicrosoftAjaxMinifier\AjaxMin.tasks&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;2. Now create ItemGroups for all your js and css files like this. Separating out your non minified files and minified files. This can go in the AfterBuild container.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Target&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;AfterBuild&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #008000"&gt;&amp;lt;!-- Javascript files that need minimizing --&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;JSMin&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Scripts\jqModal.js&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum6" style="color: #606060"&gt;   6:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;JSMin&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Scripts\jquery.jcarousel.js&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum7" style="color: #606060"&gt;   7:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;JSMin&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Scripts\shadowbox.js&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum8" style="color: #606060"&gt;   8:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum9" style="color: #606060"&gt;   9:&lt;/span&gt;     &lt;span style="color: #008000"&gt;&amp;lt;!-- CSS files that need minimizing --&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum10" style="color: #606060"&gt;  10:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum11" style="color: #606060"&gt;  11:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;CSSMin&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Content\Site.css&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum12" style="color: #606060"&gt;  12:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;CSSMin&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Content\themes\base\jquery-ui.css&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum13" style="color: #606060"&gt;  13:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;CSSMin&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Content\shadowbox.css&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum14" style="color: #606060"&gt;  14:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #008000"&gt;&amp;lt;!-- Javascript files to combine --&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;JSCat&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Scripts\jqModal.min.js&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;JSCat&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Scripts\jquery.jcarousel.min.js&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;JSCat&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Scripts\shadowbox.min.js&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum6" style="color: #606060"&gt;   6:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum7" style="color: #606060"&gt;   7:&lt;/span&gt; &lt;span style="color: #008000"&gt;&amp;lt;!-- CSS files to combine --&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum8" style="color: #606060"&gt;   8:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum9" style="color: #606060"&gt;   9:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;CSSCat&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Content\Site.min.css&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum10" style="color: #606060"&gt;  10:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;CSSCat&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Content\themes\base\jquery-ui.min.css&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum11" style="color: #606060"&gt;  11:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;CSSCat&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Include&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Content\shadowbox.min.css&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum12" style="color: #606060"&gt;  12:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ItemGroup&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;3. Call AjaxMin to do the crunching.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Message&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Minimizing JS and CSS Files...&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Importance&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;High&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;AjaxMin&lt;/span&gt; &lt;span style="color: #ff0000"&gt;JsSourceFiles&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;@(JSMin)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;JsSourceExtensionPattern&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;\.js$&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;JsTargetExtension&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;.min.js&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;JsEvalTreatment&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;MakeImmediateSafe&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;CssSourceFiles&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;@(CSSMin)&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;CssSourceExtensionPattern&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;\.css$&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;CssTargetExtension&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;.min.css&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This will create the *.min.css and *.min.js files in the same directory the original files were.&lt;/p&gt;

&lt;p&gt;4. Now concatenate the minified files into one for javascript and another for css. Here we write out the files with a default file name. In later posts I will cover versioning these files the same as your project assembly again to help performance.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;
    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Message&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Concat JS Files...&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Importance&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;High&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ReadLinesFromFile&lt;/span&gt; &lt;span style="color: #ff0000"&gt;File&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;%(JSCat.Identity)&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Output&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TaskParameter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Lines&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ItemName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;JSLinesSite&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ReadLinesFromFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;WriteLinestoFile&lt;/span&gt; &lt;span style="color: #ff0000"&gt;File&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Scripts\site-script.combined.min.js&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Lines&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;@(JSLinesSite)&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum6" style="color: #606060"&gt;   6:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;Overwrite&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum7" style="color: #606060"&gt;   7:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Message&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Concat CSS Files...&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Importance&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;High&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum8" style="color: #606060"&gt;   8:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;ReadLinesFromFile&lt;/span&gt; &lt;span style="color: #ff0000"&gt;File&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;%(CSSCat.Identity)&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum9" style="color: #606060"&gt;   9:&lt;/span&gt;       &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;Output&lt;/span&gt; &lt;span style="color: #ff0000"&gt;TaskParameter&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Lines&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;ItemName&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;CSSLinesSite&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum10" style="color: #606060"&gt;  10:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;ReadLinesFromFile&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum11" style="color: #606060"&gt;  11:&lt;/span&gt;     &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;WriteLinestoFile&lt;/span&gt; &lt;span style="color: #ff0000"&gt;File&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Content\site-style.combined.min.css&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Lines&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;@(CSSLinesSite)&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum12" style="color: #606060"&gt;  12:&lt;/span&gt;     &lt;span style="color: #ff0000"&gt;Overwrite&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;true&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;5. Save the project file, if you have Visual Studio open it will ask you to reload the project. You can now run a build and these minified and combined files will be created automatically. &lt;/p&gt;

&lt;p&gt;6. Finally reference these minified combined files in your web page.&lt;/p&gt;

&lt;p&gt;In the next two posts I will cover versioning these files to match your assembly.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=8354486" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/HJ-HWt3t8Wc" height="1" width="1"/&gt;</description><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2012/03/19/web-site-performance-and-assembly-versioning.aspx</feedburner:origLink></item><item><title>Full Circle</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/15uDgKeKVIU/full-circle.aspx</link><pubDate>Thu, 03 Mar 2011 09:55:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7715227</guid><dc:creator>capgpilk</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7715227</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7715227</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2011/03/03/full-circle.aspx#comments</comments><description>&lt;p&gt;Things have been a little bit hectic these past 6 months hence the lack of posts. My excuse is a good one though, my wife gave birth to our first son Tom back in September and it has been one hell of a rollercoaster ride since then. Things have settled back down now thank hevens.&lt;/p&gt;&lt;p&gt;My last development gig didn't quite work out so now I have took the plunge and started contracting. It turns out my first contract is with the NHS trust that I started my development career with, which seems a bit wierd as that was 10 years ago. A lot has changed in the techniques and tools the NHS now use to develop with, there is a lot more .net with a slant towards the web side of the spectrum (at least in this NHS trust). They are really getting to grips with the MVC platform, so you will hopefully see some MVC posts coming up. &lt;/p&gt;&lt;p&gt;The really suprising thing is that the Intranet I developed back in 2001 (classic asp migrated to .net 1.0) is still up and running and will finally be fazed out these coming weeks (to Sharepoint). It is like seeing an old friend all grown up.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7715227" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/15uDgKeKVIU" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/General+stuff/default.aspx">General stuff</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/MVC/default.aspx">MVC</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2011/03/03/full-circle.aspx</feedburner:origLink></item><item><title>Branching and Merging with TortoiseSVN</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/yV4dejj-rNw/branching-and-merging-with-tortoisesvn.aspx</link><pubDate>Wed, 19 May 2010 19:03:35 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7490123</guid><dc:creator>capgpilk</dc:creator><slash:comments>7</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7490123</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7490123</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2010/05/19/branching-and-merging-with-tortoisesvn.aspx#comments</comments><description>&lt;p&gt;For this example I am using Visual Studio 2010, &lt;a href="http://tortoisesvn.tigris.org/" target="_blank"&gt;TortoiseSVN&lt;/a&gt; 1.6.6, &lt;a href="http://subversion.apache.org/" target="_blank"&gt;Subversion&lt;/a&gt; 1.6.6 and &lt;a href="http://ankhsvn.open.collab.net/" target="_blank"&gt;AnkhSVN&lt;/a&gt; 2.1.7819.411, so if you are using different versions, some of these screen shots may differ.&lt;/p&gt;  &lt;p&gt;This is assuming you have your code checked in to the trunk directory and have a standard SVN structure of trunk, branches and tags. There are a number of developers who prefer to develop solely in a branch and never touch the trunk, but the process is generally the same and you may be on a small team and prefer to work in the trunk and branch occasionally.&lt;/p&gt;  &lt;p&gt;There are three steps to successful branching. First you branch, then when you are ready you need to reintegrate any changes that other developers may have made to the trunk in to your branch. Then finally when your branch and the trunk are in sync, you merge it back in to the trunk.&lt;/p&gt;  &lt;h2&gt;Branch&lt;/h2&gt;  &lt;ol&gt;   &lt;li&gt;Right click project root in Windows Explorer &amp;gt; TortoiseSVN &amp;gt; Branch/Tag      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/11_2A7D9D9F.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1 - 1" border="0" alt="1 - 1" src="http://weblogs.asp.net/blogs/garrypilkington/11_thumb_03332E9D.png" width="504" height="531" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Enter the branch label in the ‘To URL’ box. For example /branches/1.1      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/12_4063BD97.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1 - 2" border="0" alt="1 - 2" src="http://weblogs.asp.net/blogs/garrypilkington/12_thumb_5C44CCC2.png" width="374" height="419" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Choose Head revision &lt;/li&gt;    &lt;li&gt;Check Switch working copy &lt;/li&gt;    &lt;li&gt;Click OK &lt;/li&gt;    &lt;li&gt;Make any changes to branch      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/13_6A5395F2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1 - 3" border="0" alt="1 - 3" src="http://weblogs.asp.net/blogs/garrypilkington/13_thumb_74581150.png" width="377" height="459" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Make any changes to trunk      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/14_2215B449.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1 - 4" border="0" alt="1 - 4" src="http://weblogs.asp.net/blogs/garrypilkington/14_thumb_7A030529.png" width="408" height="196" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Commit any changes      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/15_3411D209.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="1 - 5" border="0" alt="1 - 5" src="http://weblogs.asp.net/blogs/garrypilkington/15_thumb_12827CAD.png" width="390" height="298" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;For this example I copied the project to another location prior to branching and made changes to that using Notepad++. Then committed it to SVN, as this directory is mapped to the trunk, that is what gets updated.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Merge Trunk with Branch&lt;/h2&gt;  &lt;ol&gt;   &lt;li&gt;Right click project root in Windows Explorer &amp;gt; TortoiseSVN &amp;gt; Merge      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/21_6F05D847.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 - 1" border="0" alt="2 - 1" src="http://weblogs.asp.net/blogs/garrypilkington/21_thumb_7EE4F73E.png" width="327" height="402" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Choose ‘Merge a range of revisions’      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/22_25172ACA.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 - 2" border="0" alt="2 - 2" src="http://weblogs.asp.net/blogs/garrypilkington/22_thumb_264B9DDC.png" width="406" height="383" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;In ‘URL to merge from’ choose your trunk      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/23_1D2EEC8E.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 - 3" border="0" alt="2 - 3" src="http://weblogs.asp.net/blogs/garrypilkington/23_thumb_298CE9EA.png" width="403" height="368" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Click Next, then the ‘test merge’ button. This will highlight any conflicts. Here we have one conflict we will need to resolve because we made a change and checked in to trunk earlier      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/24_4501C620.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 - 4" border="0" alt="2 - 4" src="http://weblogs.asp.net/blogs/garrypilkington/24_thumb_2EEB34C1.png" width="411" height="377" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/25_4B3876E1.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 - 5" border="0" alt="2 - 5" src="http://weblogs.asp.net/blogs/garrypilkington/25_thumb_6719860C.png" width="416" height="177" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Click merge. Now we have the opportunity to edit that conflict      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/25a_043F2E17.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 -5 - a" border="0" alt="2 -5 - a" src="http://weblogs.asp.net/blogs/garrypilkington/25a_thumb_0698B015.png" width="442" height="265" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;This will open up TortoiseMerge which will allow us to resolve the issue. In this case I want both changes.      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/25b_6962E23D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 -5 - b" border="0" alt="2 -5 - b" src="http://weblogs.asp.net/blogs/garrypilkington/25b_thumb_7A767446.png" width="448" height="320" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/25c_75D043BF.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 -5 - c" border="0" alt="2 -5 - c" src="http://weblogs.asp.net/blogs/garrypilkington/25c_thumb_4CE52EB6.png" width="449" height="286" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/25d_28902467.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 -5 - d" border="0" alt="2 -5 - d" src="http://weblogs.asp.net/blogs/garrypilkington/25d_thumb_26DF5893.png" width="463" height="276" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Perform an Update then Commit      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/27a_69FAB0F3.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 - 7 - a" border="0" alt="2 - 7 - a" src="http://weblogs.asp.net/blogs/garrypilkington/27a_thumb_707E0AB6.png" width="345" height="491" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/27b_4B509A7D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 - 7 - b" border="0" alt="2 - 7 - b" src="http://weblogs.asp.net/blogs/garrypilkington/27b_thumb_26FB902E.png" width="348" height="527" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Reloading in Visual Studio shows we have all changes that have been made to both trunk and branch.&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/28_0161ED00.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="2 - 8" border="0" alt="2 - 8" src="http://weblogs.asp.net/blogs/garrypilkington/28_thumb_672183DB.png" width="531" height="243" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt; &lt;/ol&gt;  &lt;h2&gt;Merge Branch with Trunk&lt;/h2&gt;  &lt;ol&gt;   &lt;li&gt;Switch working copy by right clicking project root in Windows Explorer &amp;gt; TortoiseSVN &amp;gt; switch&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/33_590294DE.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3 - 3" border="0" alt="3 - 3" src="http://weblogs.asp.net/blogs/garrypilkington/33_thumb_44D95288.png" width="475" height="453" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Switch to the trunk then ok      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/34_0C1E82AE.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3 - 4" border="0" alt="3 - 4" src="http://weblogs.asp.net/blogs/garrypilkington/34_thumb_1C4A4AA7.png" width="488" height="298" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Right click project root in Windows Explorer &amp;gt; TortoiseSVN &amp;gt; merge      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/35_4669D2C2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3 - 5" border="0" alt="3 - 5" src="http://weblogs.asp.net/blogs/garrypilkington/35_thumb_51EF6A34.png" width="493" height="464" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Choose ‘Reintegrate a branch’      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/36_58924DEA.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3 - 6" border="0" alt="3 - 6" src="http://weblogs.asp.net/blogs/garrypilkington/36_thumb_79759AC4.png" width="472" height="433" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;In ‘From URL’ choose your branch then next      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/37_577A1273.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3 - 7" border="0" alt="3 - 7" src="http://weblogs.asp.net/blogs/garrypilkington/37_thumb_3AB07791.png" width="477" height="440" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Click ‘Test merge’, this shouldn’t show any conflicts      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/38_4BD42F67.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3 - 8" border="0" alt="3 - 8" src="http://weblogs.asp.net/blogs/garrypilkington/38_thumb_0BDA9922.png" width="489" height="445" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Click Merge &lt;/li&gt;    &lt;li&gt;Perform Update then Commit      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/310_46FE4F20.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3 - 10" border="0" alt="3 - 10" src="http://weblogs.asp.net/blogs/garrypilkington/310_thumb_3DE19DD2.png" width="360" height="445" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/310a_6413D15D.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="3 - 10 - a" border="0" alt="3 - 10 - a" src="http://weblogs.asp.net/blogs/garrypilkington/310a_thumb_7869711B.png" width="362" height="484" /&gt;&lt;/a&gt;       &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Open project in Visual Studio, we now have all changes. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;So there we have it we are connected back to the trunk and have all the updates merged.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7490123" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/yV4dejj-rNw" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Continuous+Integration/default.aspx">Continuous Integration</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Tools/default.aspx">Tools</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2010/05/19/branching-and-merging-with-tortoisesvn.aspx</feedburner:origLink></item><item><title>Setting Up MVC Using StructureMap, Moq and NUnit...Quickly</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/Qs2dcr95QTk/setting-up-ioc-with-mvc-quickly.aspx</link><pubDate>Sun, 21 Feb 2010 19:28:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7356698</guid><dc:creator>capgpilk</dc:creator><slash:comments>5</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7356698</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7356698</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2010/02/21/setting-up-ioc-with-mvc-quickly.aspx#comments</comments><description>&lt;p&gt;When I was first attracted to the Microsoft MVC Framework, one of my main ambitions was to develop using a more test driven approach. There are ways to include Unit testing with WebForms, but the friction was just too much to justify on the web projects I was involved with.&lt;/p&gt;  &lt;p&gt;As soon as I started using MVC I was amazed at how easy it was to incorporate unit testing and isolation frameworks; in a way it became more of a natural process.&lt;/p&gt;  &lt;p&gt;Here in this post I am quickly covering getting up and running with unit testing, isolation frameworks and MVC.&lt;/p&gt;  &lt;p&gt;My tools of choice are:-&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://www.nunit.org" target="_blank" mce_href="http://www.nunit.org"&gt;NUnit &lt;/a&gt;– Testing&lt;/li&gt;    &lt;li&gt;&lt;a href="http://code.google.com/p/moq/" target="_blank" mce_href="http://code.google.com/p/moq/"&gt;Moq &lt;/a&gt;– Isolation framework&lt;/li&gt;    &lt;li&gt;&lt;a href="http://structuremap.sourceforge.net" target="_blank" mce_href="http://structuremap.sourceforge.net"&gt;StructureMap &lt;/a&gt;– IoC framework&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;This example is a simple green field site; the typical File &amp;gt;&amp;gt; New Project &amp;gt;&amp;gt; MVC application.&lt;/p&gt;  &lt;p&gt;So we have our site, I want data from a database (in this example I won’t be bothering with creating a data store, which shows just how handy stubs can be).&lt;/p&gt;  &lt;p&gt;I want to run a test on the data and send it off to the view, simple stuff.&lt;/p&gt;  &lt;p&gt;In Models, I want to create a data repository, but I don’t want to code against a concrete type, I will use an interface.&lt;/p&gt;  &lt;p&gt;&lt;br&gt;&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;     &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;interface&lt;/span&gt; IRepository&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; GetTotalOrders();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; Repository : IRepository&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; GetTotalOrders()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; 55;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Here I have a simple method which in this case returns a hard coded integer.&lt;/p&gt;

&lt;p&gt;So far so good, the site compiles.&lt;/p&gt;

&lt;p&gt;I want the controller to handle this method call via an Order class like this.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; Order&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; IRepository Repository;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Order(IRepository repository)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        Repository = repository;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; GetTotalOrders()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; Repository.GetTotalOrders();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;As can be seen there are two SOLID principles in use here. The Order is dependent on the Repository class, but this dependency is injected in to the constructor. Also it is handed an interface and not a concrete type.&lt;/p&gt;

&lt;p&gt;So my controller can call the GetTotalOrders method on the Order and let that handle the repository, but before all that I want a test in place that will make sure I am returning that data from the repository.&lt;/p&gt;

&lt;p&gt;Of course in the real world I don’t want to touch the database, and in this case I don’t even have one. Here is the unit test that stubs out the repository call.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;[Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; GetTotalOrders_returns_56()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;//Arrange&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    var repositoryMock = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Mock&amp;lt;IRepository&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    repositoryMock.Setup(r =&amp;gt; r.GetTotalOrders()).Returns(56);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    Order orders = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Order(repositoryMock.Object);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;//Act&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; expectedValue = 56;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; actualValue = orders.GetTotalOrders();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    &lt;span style="color: rgb(0, 128, 0);"&gt;//Assert&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    Assert.AreEqual(expectedValue, actualValue);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;In this case I am forcing the repository to return an integer of 56, not the 55 from the concrete class. The solution compiles and the test passes.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/mvc_post_1_12FC3AE3.png" mce_href="http://weblogs.asp.net/blogs/garrypilkington/mvc_post_1_12FC3AE3.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/garrypilkington/mvc_post_1_thumb_2A473F54.png" title="mvc_post_1" style="border: 0px none ; display: inline;" alt="mvc_post_1" mce_src="http://weblogs.asp.net/blogs/garrypilkington/mvc_post_1_thumb_2A473F54.png" border="0" height="227" width="499"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;Great, but how do we code this for the controller.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; HomeController : Controller&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; HomeController()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; ActionResult Index()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        Repository repository = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Repository();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        Order orders = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Order(repository);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; totalOrders = orders.GetTotalOrders();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        ViewData[&lt;span style="color: rgb(0, 96, 128);"&gt;"TotalOrders"&lt;/span&gt;] = totalOrders.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; View();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This works fine, but I don’t want the Index method to be responsible of creating the Repository object, so we take that out and let the constructor handle that.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; HomeController : Controller&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;readonly&lt;/span&gt; IRepository Repository;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; HomeController(IRepository repository)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        Repository = repository;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; ActionResult Index()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        Order orders = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Order(Repository);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; totalOrders = orders.GetTotalOrders();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        ViewData[&lt;span style="color: rgb(0, 96, 128);"&gt;"TotalOrders"&lt;/span&gt;] = totalOrders.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; View();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Now it compiles ok, the tests run ok, but the web application fails.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/mvc_post_2_34B7EDA7.png" mce_href="http://weblogs.asp.net/blogs/garrypilkington/mvc_post_2_34B7EDA7.png"&gt;&lt;img src="http://weblogs.asp.net/blogs/garrypilkington/mvc_post_2_thumb_6D5271E7.png" title="mvc_post_2" style="border: 0px none ; display: inline;" alt="mvc_post_2" mce_src="http://weblogs.asp.net/blogs/garrypilkington/mvc_post_2_thumb_6D5271E7.png" border="0" height="330" width="561"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This is where we need to start injecting the dependencies needed. We need both an ApplicationRegistry and Bootstrapper class.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; ApplicationRegistry : Registry&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; ApplicationRegistry()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;            ForRequestedType&amp;lt;IRepository&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;             .TheDefault.Is.OfConcreteType&amp;lt;Repository&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;nbsp;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; Bootstrapper&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; ConfigureStructureMap()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        ObjectFactory.Initialize&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;            (x =&amp;gt; x.AddRegistry(&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ApplicationRegistry()));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The ApplicationRegistry class reads very fluently and simply injects any occurrence of the IRepository type with the Repository concrete type.&lt;/p&gt;

&lt;p&gt;Next we need a controller factory which inherits from the MVC DefaultControllerFactory and is called from the Application_Start in the Global.asax file.&lt;/p&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; StructureMapControllerFactory : DefaultControllerFactory&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;override&lt;/span&gt; IController GetControllerInstance(Type controllerType)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (controllerType == &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;) &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; ObjectFactory.GetInstance(controllerType) &lt;span style="color: rgb(0, 0, 255);"&gt;as&lt;/span&gt; Controller;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt; (StructureMapException)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;            System.Diagnostics.Debug.WriteLine(ObjectFactory.WhatDoIHave());&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;            &lt;span style="color: rgb(0, 0, 255);"&gt;throw&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;br&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;protected&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; Application_Start()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    Bootstrapper.ConfigureStructureMap();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;    ControllerBuilder.Current.SetControllerFactory&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;      (&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; StructureMapControllerFactory());&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&amp;nbsp;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;    RegisterRoutes(RouteTable.Routes);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Now rebuilding and running the site we successfully retrieve the value from the repository.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7356698" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/Qs2dcr95QTk" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Dependency+Injection/default.aspx">Dependency Injection</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Inversion+of+Control/default.aspx">Inversion of Control</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/MVC/default.aspx">MVC</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Unit+Testing/default.aspx">Unit Testing</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2010/02/21/setting-up-ioc-with-mvc-quickly.aspx</feedburner:origLink></item><item><title>WinMerge as a Comparison Tool in Visual Studio 2008</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/7t8C0nBQhUU/winmerge-as-a-comparison-tool-in-visual-studio-2008.aspx</link><pubDate>Wed, 16 Dec 2009 15:49:18 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7280237</guid><dc:creator>capgpilk</dc:creator><slash:comments>11</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7280237</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7280237</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2009/12/16/winmerge-as-a-comparison-tool-in-visual-studio-2008.aspx#comments</comments><description>&lt;p&gt;Ok I know VS 2010 is the new toy to be seen playing around with, but as I have just recently&amp;#160; got delivery of my new Windows 7 pc I thought I would document how to get &lt;a href="http://winmerge.org/" target="_blank"&gt;WinMerge&lt;/a&gt; to work as a comparison tool with VS2008 Team System. If for anything, so I know myself when the time comes to do it all over again.&lt;/p&gt;  &lt;p&gt;Team Foundation Server does have a built in comparison and merge tool, but personally I find WinMerge to be far better. Oh and it is free.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;After downloading and installing, you need to configure Visual Studio. Go to Tools &amp;gt;&amp;gt; Options      &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Find the ‘Source Control’ section in the tree view and select ‘Visual Studio Team Foundation Server’      &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Click the ‘Configure User Tools’ button.      &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/WinMerge1_04814021.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="WinMerge1" border="0" alt="WinMerge1" src="http://weblogs.asp.net/blogs/garrypilkington/WinMerge1_thumb_1A1B78BE.png" width="417" height="247" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Click on the ‘Add’ button on the ‘Configure User Tools’ window.      &lt;br /&gt;      &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Enter these values in the textboxes:      &lt;br /&gt;      &lt;br /&gt;Extension: *       &lt;br /&gt;Operation: Compare       &lt;br /&gt;Command: C:\Program Files\WinMerge\WinMergeU.exe (or wherever you have installed WinMerge to)       &lt;br /&gt;Arguments: /x /e /ub /wl /dl %6 /dr %7 %1 %2       &lt;br /&gt;      &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/WinMerge2_19CECFBC.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="WinMerge2" border="0" alt="WinMerge2" src="http://weblogs.asp.net/blogs/garrypilkington/WinMerge2_thumb_577BB778.png" width="343" height="190" /&gt;&lt;/a&gt;       &lt;br /&gt;&lt;/li&gt;    &lt;li&gt;Click OK all the way back down to get back to the main IDE. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Now when you view a file history from Solution Explorer it will start up WinMerge.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7280237" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/7t8C0nBQhUU" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/General+stuff/default.aspx">General stuff</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Tools/default.aspx">Tools</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2009/12/16/winmerge-as-a-comparison-tool-in-visual-studio-2008.aspx</feedburner:origLink></item><item><title>Windows Explorer and Microsoft SkyDrive</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/4W4i0eAJzYI/windows-explorer-and-microsoft-skydrive.aspx</link><pubDate>Fri, 13 Nov 2009 09:55:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7253295</guid><dc:creator>capgpilk</dc:creator><slash:comments>4</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7253295</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7253295</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2009/11/13/windows-explorer-and-microsoft-skydrive.aspx#comments</comments><description>&lt;p&gt;Bit by bit more of our lives are moving in to the cloud. I have been a bit late to this party as I have never published my photos to Flikr or any other image sharing site. That is mainly because I want to keep them secret and I am really just after an off site backup solution. What I have been after is great easy storage with enough disk space for all my photographs. There are plenty of places out on the web which offer this service I know, but I want it cheap or free. This is where &lt;a href="http://skydrive.live.com" target="_blank"&gt;Microsoft SkyDrive&lt;/a&gt; comes in with a whopping 25GB of private storage. &lt;/p&gt;  &lt;p&gt;Great, but what I was after was simple integration with the Windows UI without having to go through a web interface. This had deterred me from using it until I came across a piece of software called &lt;a href="http://www.gladinet.com/" target="_blank"&gt;Cloud Desktop from Gladinet&lt;/a&gt;. After installation and a bit of minor configuration, it gives you access to your SkyDrive through a virtual network drive. It comes in three editions, with the Starter being free. The main limit of the free version is that you can only upload a maximum of 1000 files at a time. Simply drag and drop your files in to the virtual drive and you are away. A great resource to help you get up and running is &lt;a href="http://www.newbtech.com/2009/04/live-skydrive-how-to-set-up-as-network.html" target="_blank"&gt;this link from newbTech&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;For easy synchronization between Windows directories and the cloud, there is always &lt;a href="https://www.mesh.com/welcome/default.aspx" target="_blank"&gt;Live Mesh&lt;/a&gt;, but it would be great if Microsoft would release a SkyDrive API so we could have more control through our applications, perhaps hooking up the &lt;a href="http://msdn.microsoft.com/en-gb/sync/default.aspx" target="_blank"&gt;Sync Framework&lt;/a&gt;.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7253295" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/4W4i0eAJzYI" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Sync+Framework/default.aspx">Sync Framework</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Tools/default.aspx">Tools</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2009/11/13/windows-explorer-and-microsoft-skydrive.aspx</feedburner:origLink></item><item><title>Multiple Strongly Typed Partial Views in MVC</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/HksBUnOuyH4/multiple-strongly-typed-partial-views-in-mvc.aspx</link><pubDate>Tue, 20 Oct 2009 08:29:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7233628</guid><dc:creator>capgpilk</dc:creator><slash:comments>13</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7233628</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7233628</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2009/10/20/multiple-strongly-typed-partial-views-in-mvc.aspx#comments</comments><description>&lt;p&gt;Creating strongly typed views with the ASP.Net MVC framework is really easy, but what if you want to have multiple types on the same view? One way to achieve this is to create partial views for each type and creating a combined view model. Then the view will inherit this combined view model and each partial view will inherit from its component types.&lt;/p&gt;  &lt;p&gt;In the following simple example I have a view which itself displays two partial views. This view inherits from a type I have called CombinedViewModel.&lt;/p&gt;  &lt;p&gt;The hosting view&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum1"&gt;   &lt;/span&gt;&amp;lt;%@ Page Title=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;&amp;quot;&lt;/span&gt; Language=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt; MasterPageFile=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;~/Views/Shared/Site.Master&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum2"&gt;   &lt;/span&gt;Inherits=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;System.Web.Mvc.ViewPage&amp;lt;CombinedViewModel&amp;gt;&amp;quot;&lt;/span&gt; %&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum3"&gt;   &lt;/span&gt;...&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum4"&gt;   &lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum5"&gt;  &lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum6"&gt;   &lt;/span&gt;&amp;lt;asp:Content ID=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;Content1&amp;quot;&lt;/span&gt; ContentPlaceHolderID=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;MainContent&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum7"&gt;   &lt;/span&gt;runat=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;server&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum8"&gt;   &lt;/span&gt;     &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum9"&gt;   &lt;/span&gt;&amp;lt;% Html.RenderPartial(&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;PartialView1&amp;quot;&lt;/span&gt;, ViewData.Model.Header); %&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum10"&gt;   &lt;/span&gt;&amp;lt;% Html.RenderPartial(&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;PartialView2&amp;quot;&lt;/span&gt;, ViewData.Model.Detail); %&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum11"&gt;  &lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(96,96,96)" id="lnum12"&gt;  &lt;/span&gt;&amp;lt;/asp:Content&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;The controller passes the types in to the CombinedViewModel.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; ActionResult Detail(&lt;span style="color: rgb(0,0,255)"&gt;int&lt;/span&gt; id)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  Header header = DataRepository.GetHeader(id);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  List&amp;lt;Detail&amp;gt; detail = DataRepository.GetDetail(id);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  CombinedViewModel viewData = &lt;span style="color: rgb(0,0,255)"&gt;new&lt;/span&gt; CombinedViewModel(header, detail);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: rgb(0,0,255)"&gt;return&lt;/span&gt; View(viewData);         &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;The CombinedViewModel&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0,0,255)"&gt;class&lt;/span&gt; CombinedViewModel&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; Header  Header { get; &lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; set; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; &lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; IEnumerable&amp;lt;Detail&amp;gt; Detail { get; &lt;span style="color: rgb(0,0,255)"&gt;private&lt;/span&gt; set; }  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: rgb(0,0,255)"&gt;public&lt;/span&gt; JobDetailViewModel(Header header, IEnumerable&amp;lt;Detail&amp;gt; detail)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; Header = header;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt; Detail= detail;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;So now each of the partial views can access the types they need.&lt;/p&gt;

&lt;p&gt;The PartialViews&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;div id="codeSnippetWrapper"&gt;
      &lt;div id="codeSnippetWrapper"&gt;
        &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
          &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;p&gt;&amp;lt;%@ Control Language=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;Inherits=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;System.Web.Mvc.ViewUserControl&amp;lt;TestApp.Models.Header&amp;gt;&amp;quot;&lt;/span&gt; %&amp;gt;&lt;/p&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;

    &lt;div id="codeSnippetWrapper"&gt;
      &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
        &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;%= Model.CustomerTitle%&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&lt;p&gt;&amp;lt;%@ Control Language=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt; &lt;/p&gt;&lt;p&gt;Inherits=&lt;span style="color: rgb(0,96,128)"&gt;&amp;quot;System.Web.Mvc.ViewUserControl&amp;lt;IEnumerable&amp;lt;TestApp.Models.Detail&amp;gt;&amp;gt;&amp;quot;&lt;/span&gt; %&amp;gt;&lt;/p&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: rgb(244,244,244); padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: white; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;,courier,monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"&gt;&amp;lt;%= Model.OrderNumber%&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7233628" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/HksBUnOuyH4" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/MVC/default.aspx">MVC</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2009/10/20/multiple-strongly-typed-partial-views-in-mvc.aspx</feedburner:origLink></item><item><title>Unit Testing Videos</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/mra8r3Gm7M0/unit-testing-videos.aspx</link><pubDate>Mon, 12 Oct 2009 09:16:47 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7227736</guid><dc:creator>capgpilk</dc:creator><slash:comments>1</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7227736</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7227736</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2009/10/12/unit-testing-videos.aspx#comments</comments><description>&lt;p&gt;The &lt;a href="http://www.learnvisualstudio.net/" target="_blank"&gt;Learn Visual Studio.net&lt;/a&gt; website has just published a &lt;a href="http://www.learnvisualstudio.net/content/series/Unit_Testing_401.aspx" target="_blank"&gt;new series on unit testing&lt;/a&gt;, covering an introduction to unit testing, using MSTest, and NUnit. These are always good sources of practical information to help you get up to speed on anything .net. Go check them out.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7227736" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/mra8r3Gm7M0" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/General+stuff/default.aspx">General stuff</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Unit+Testing/default.aspx">Unit Testing</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2009/10/12/unit-testing-videos.aspx</feedburner:origLink></item><item><title>TempData and DropDownList in ASP.Net MVC</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/hirTSZL-60U/tempdata-and-dropdownlist-in-asp-net-mvc.aspx</link><pubDate>Tue, 29 Sep 2009 10:15:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7219853</guid><dc:creator>capgpilk</dc:creator><slash:comments>7</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7219853</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7219853</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2009/09/29/tempdata-and-dropdownlist-in-asp-net-mvc.aspx#comments</comments><description>&lt;p&gt;&lt;b&gt;TempData&lt;/b&gt;     &lt;br&gt;    &lt;br&gt;Sometimes while developing web applications, you have a need to keep certain data between web requests. In asp.Net MVC you can use TempData which will keep hold of any values you pass to it for that request and the next request when it is then removed. This is a great way of keeping form elements at a particular state during form submission from an mvc view. In the following example I will briefly explain how to render a drop down list populated with data which will keep the selected value across form submission.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;The ActionResult&lt;/b&gt;     &lt;br&gt;    &lt;br&gt;In the ActionResult in the controller for the view you get the value of the drop down selected item which is held in the FormCollection. Then simply call a method that returns a IList&amp;lt;SelectListItem&amp;gt; collection, passing in the selected item. The resulting collection is then passed to a TempDataDictionary which is in turn passed back to the view.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;" id="codeSnippet"&gt;     &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; ActionResult DistrictsView(FormCollection collection)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; selectedValue = Convert.ToInt32(collection[&lt;span style="color: rgb(0, 96, 128);"&gt;"Districts"&lt;/span&gt;]);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;   TempData[&lt;span style="color: rgb(0, 96, 128);"&gt;"Districts"&lt;/span&gt;] = DropDownPopulators.GetDistricts(selectedValue);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; View();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Keeping the selected value 
    &lt;br&gt;

    &lt;br&gt;&lt;/b&gt;The drop down list takes a collection of SelectlistItems in the form of text/value pairs. What the following method does is generate a dictionary collection of districts and the associated key, then creates the IList&amp;lt;SelectListItem&amp;gt; for the drop down, but it also sets the selected property to true for the selected value passed in from the view. The GetDistrictList method call simply returns a dictionary collection from the database of district and integer values.&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;" id="codeSnippet"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; IList&amp;lt;SelectListItem&amp;gt; GetDistricts(&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; selectedValue)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;   IList&amp;lt;SelectListItem&amp;gt; districts = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; List&amp;lt;SelectListItem&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;   Dictionary&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt; districtCollection &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;    = DataRepository.GetDistrictList();  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;   SelectListItem itemAll = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SelectListItem();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;   itemAll.Value = &lt;span style="color: rgb(0, 96, 128);"&gt;"0"&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;   itemAll.Text = &lt;span style="color: rgb(0, 96, 128);"&gt;"All"&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;   districts.Add(itemAll);   &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;foreach&lt;/span&gt; (&lt;span style="color: rgb(0, 0, 255);"&gt;var&lt;/span&gt; dist &lt;span style="color: rgb(0, 0, 255);"&gt;in&lt;/span&gt; districtCollection)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;   {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (dist.Key == selectedValue)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt;  17:&lt;/span&gt;     SelectListItem item = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SelectListItem();  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt;  18:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt;  19:&lt;/span&gt;     item.Value = dist.Key.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum20"&gt;  20:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum21"&gt;  21:&lt;/span&gt;     item.Text = dist.Value;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum22"&gt;  22:&lt;/span&gt;     item.Selected = &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum23"&gt;  23:&lt;/span&gt;     districts.Add(item);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum24"&gt;  24:&lt;/span&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum25"&gt;  25:&lt;/span&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum26"&gt;  26:&lt;/span&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum27"&gt;  27:&lt;/span&gt;     SelectListItem item = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SelectListItem();  &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum28"&gt;  28:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum29"&gt;  29:&lt;/span&gt;     item.Value = dist.Key.ToString();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum30"&gt;  30:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum31"&gt;  31:&lt;/span&gt;     item.Text = dist.Value;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum32"&gt;  32:&lt;/span&gt;     item.Selected = &lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum33"&gt;  33:&lt;/span&gt;     districts.Add(item);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum34"&gt;  34:&lt;/span&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum35"&gt;  35:&lt;/span&gt;   }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum36"&gt;  36:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; districts;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum37"&gt;  37:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Displaying the DropDownList in a view&lt;/b&gt;&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;" id="codeSnippet"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;%=Html.DropDownList(&lt;span style="color: rgb(0, 96, 128);"&gt;"Districts"&lt;/span&gt;, TempData[&lt;span style="color: rgb(0, 96, 128);"&gt;"Districts"&lt;/span&gt;] &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;as&lt;/span&gt; List&amp;lt;SelectListItem&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;  , &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; { &lt;span style="color: rgb(204, 102, 51);"&gt;@onchange&lt;/span&gt; = &lt;span style="color: rgb(0, 96, 128);"&gt;"this.form.submit();"&lt;/span&gt; })%&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This binds the Districts TempData to the DropDownList helper in the view. The clever bit here is the creation of the form submit java script when the drop down is changed.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7219853" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/hirTSZL-60U" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/MVC/default.aspx">MVC</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2009/09/29/tempdata-and-dropdownlist-in-asp-net-mvc.aspx</feedburner:origLink></item><item><title>Code Snippet Plugin for Live Writer</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/X0UCDV1YZg0/code-snippet-plugin-for-live-writer.aspx</link><pubDate>Tue, 29 Sep 2009 08:27:13 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7219805</guid><dc:creator>capgpilk</dc:creator><slash:comments>0</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7219805</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7219805</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2009/09/29/code-snippet-plugin-for-live-writer.aspx#comments</comments><description>&lt;p&gt;For anybody who regularly displays code using Live Writer, then this plugin by Leo Vildosola is a must to check out. When ever I do a rebuild of any of my computers this has to go on and I always have trouble remembering where I found it. &lt;/p&gt;  &lt;p&gt;So here are a couple of links.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://lvildosola.blogspot.com/" target="_blank"&gt;Leo Vilosola’s blog&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://wlwplugincollection.codeplex.com/Wiki/View.aspx?title=Code%20Snippet" target="_blank"&gt;Plugin site at codeplex&lt;/a&gt;&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7219805" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/X0UCDV1YZg0" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/General+stuff/default.aspx">General stuff</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Tools/default.aspx">Tools</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2009/09/29/code-snippet-plugin-for-live-writer.aspx</feedburner:origLink></item><item><title>LINQ Projection</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/OEf2M6IWnlo/linq-projection.aspx</link><pubDate>Tue, 08 Sep 2009 09:00:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7195850</guid><dc:creator>capgpilk</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7195850</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7195850</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2009/09/08/linq-projection.aspx#comments</comments><description>&lt;p&gt;just recently I have been doing quite a bit of work with LINQ and L2S in particular. Although LINQ is nothing new now and I am sure the vast majority of readers out there have had some form of introduction to LINQ. However one of the great things that I still find fascinating is a technique called projection. This is a way to shape data coming back from a query into something more akin to what you want.&lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left; max-height: 200px"&gt;   &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; class User&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt;     public string UserFullName { get; set; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt;     public double HoursWorked { get; set; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum6" style="color: #606060"&gt;   6:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum7" style="color: #606060"&gt;   7:&lt;/span&gt; class Program&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum8" style="color: #606060"&gt;   8:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum9" style="color: #606060"&gt;   9:&lt;/span&gt;     static void Main()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum10" style="color: #606060"&gt;  10:&lt;/span&gt;     {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum11" style="color: #606060"&gt;  11:&lt;/span&gt;         List&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;User&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt; users = new List&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;User&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum12" style="color: #606060"&gt;  12:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum13" style="color: #606060"&gt;  13:&lt;/span&gt;         users.Add(new User { HoursWorked = 12.5d, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum14" style="color: #606060"&gt;  14:&lt;/span&gt;             UserFullName = &amp;quot;Ann Admin&amp;quot; });&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum15" style="color: #606060"&gt;  15:&lt;/span&gt;         users.Add(new User { HoursWorked = 6.5d, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum16" style="color: #606060"&gt;  16:&lt;/span&gt;             UserFullName = &amp;quot;Test User&amp;quot; });&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum17" style="color: #606060"&gt;  17:&lt;/span&gt;         users.Add(new User { HoursWorked = 8.5d, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum18" style="color: #606060"&gt;  18:&lt;/span&gt;             UserFullName = &amp;quot;Test User&amp;quot; });&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum19" style="color: #606060"&gt;  19:&lt;/span&gt;         users.Add(new User { HoursWorked = 3.5d, &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum20" style="color: #606060"&gt;  20:&lt;/span&gt;             UserFullName = &amp;quot;Test User&amp;quot; });&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum21" style="color: #606060"&gt;  21:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum22" style="color: #606060"&gt;  22:&lt;/span&gt;         var q = from user in users&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum23" style="color: #606060"&gt;  23:&lt;/span&gt;                 where user.UserFullName.Equals(&amp;quot;Test User&amp;quot;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum24" style="color: #606060"&gt;  24:&lt;/span&gt;                 select new&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum25" style="color: #606060"&gt;  25:&lt;/span&gt;                  {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum26" style="color: #606060"&gt;  26:&lt;/span&gt;                      user.UserFullName,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum27" style="color: #606060"&gt;  27:&lt;/span&gt;                      user.HoursWorked,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum28" style="color: #606060"&gt;  28:&lt;/span&gt;                      HoursRemaining = (8.5 - user.HoursWorked)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum29" style="color: #606060"&gt;  29:&lt;/span&gt;                  };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum30" style="color: #606060"&gt;  30:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum31" style="color: #606060"&gt;  31:&lt;/span&gt;         foreach (var list in q)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum32" style="color: #606060"&gt;  32:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum33" style="color: #606060"&gt;  33:&lt;/span&gt;             Console.WriteLine(list.UserFullName + &amp;quot; - &amp;quot;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum34" style="color: #606060"&gt;  34:&lt;/span&gt;                 + list.HoursWorked&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum35" style="color: #606060"&gt;  35:&lt;/span&gt;                 + &amp;quot;(&amp;quot; + list.HoursRemaining + &amp;quot;)&amp;quot;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum36" style="color: #606060"&gt;  36:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum37" style="color: #606060"&gt;  37:&lt;/span&gt;&amp;#160; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum38" style="color: #606060"&gt;  38:&lt;/span&gt;         Console.Read();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum39" style="color: #606060"&gt;  39:&lt;/span&gt;     }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum40" style="color: #606060"&gt;  40:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Here the query is creating a new type with three fields. This is especially useful if like above you are doing some form of calculation which you want to use, but is not represented anywhere in the data model.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7195850" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/OEf2M6IWnlo" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/linq/default.aspx">linq</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2009/09/08/linq-projection.aspx</feedburner:origLink></item><item><title>Complex Types in the Entity Framework</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/qgfoEeoc0VM/complex-types-in-the-entity-framework.aspx</link><pubDate>Mon, 31 Aug 2009 15:51:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7186543</guid><dc:creator>capgpilk</dc:creator><slash:comments>2</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7186543</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7186543</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2009/08/31/complex-types-in-the-entity-framework.aspx#comments</comments><description>&lt;p&gt;In this post I will describe the process you need to go through to get a stored procedure to return a complex type in the Entity Framework.&lt;/p&gt;  &lt;p&gt;It is very easy in the Entity Framework to quickly create crud functions that will manipulate data in your tables. However if you want to use stored procedures that return data that is not mapped to an entity from your database, then there are a few more hoops you need to jump through.&lt;/p&gt;  &lt;p&gt;Firstly, by examining the stored procedure, you can determine what data types are returned from the stored procedure. &lt;/p&gt;  &lt;p&gt;This following method is a quick and dirty one I have used, there may be a better way to do this, and if there is please let me know. There is a tool called &lt;a href="http://www.devart.com/entitydeveloper/" target="_blank"&gt;Entity Developer from devart&lt;/a&gt; which may do the same, but as yet I haven’t had the chance to use it.&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Switch to your *.edmx file and drop a new entity from the toolbox on to the design surface. You may need to delete the Id property that is automatically created if you don’t need it.     &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/2_7C7C1592.jpg"&gt;&lt;img title="2" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="137" alt="2" src="http://weblogs.asp.net/blogs/garrypilkington/2_thumb_79D5EA92.jpg" width="178" border="0" /&gt;&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;Then right click on any of the entries in the model browser and choose ‘Update Model From Database’     &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/1_5714B2D5.jpg"&gt;&lt;img title="1" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="139" alt="1" src="http://weblogs.asp.net/blogs/garrypilkington/1_thumb_14386E5B.jpg" width="382" border="0" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Choose any tables that your procedure uses from the Add tab. This will map the tables as entities, allowing you to simply copy and paste entity properties from the tables into your new entity.&lt;/li&gt;    &lt;li&gt;Add your stored procedure.&lt;/li&gt;    &lt;li&gt;Right click on ‘Function Imports’ within the Entity Container in the Model Browser and choose ‘Create Function Import’.     &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/3_61D72B8C.jpg"&gt;&lt;img title="3" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="146" alt="3" src="http://weblogs.asp.net/blogs/garrypilkington/3_thumb_1EFAE712.jpg" width="348" border="0" /&gt;&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;This then gives you the options to Choose the stored procedure, its name and most importantly the Entity that it will be imported to. Choose your new entity you have just created.     &lt;br /&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/4_10BEFED3.jpg"&gt;&lt;img title="4" style="border-right: 0px; border-top: 0px; display: inline; border-left: 0px; border-bottom: 0px" height="238" alt="4" src="http://weblogs.asp.net/blogs/garrypilkington/4_thumb_1B12B3E4.jpg" width="328" border="0" /&gt;&lt;/a&gt; &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;Now your new entity can be called&lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border-right: silver 1px solid; padding-right: 4px; border-top: silver 1px solid; padding-left: 4px; font-size: 8pt; padding-bottom: 4px; margin: 20px 0px 10px; overflow: auto; border-left: silver 1px solid; width: 97.5%; cursor: text; direction: ltr; line-height: 12pt; padding-top: 4px; border-bottom: silver 1px solid; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; background-color: #f4f4f4; text-align: left; max-height: 200px"&gt;   &lt;div id="codeSnippet" style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;     &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum1" style="color: #606060"&gt;   1:&lt;/span&gt; ProjectMVCEntities myEntities = new ProjectMVCEntities();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum2" style="color: #606060"&gt;   2:&lt;/span&gt;                 &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum3" style="color: #606060"&gt;   3:&lt;/span&gt; var viewData = myEntities.Job(0, 4).ToList();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: #f4f4f4; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum4" style="color: #606060"&gt;   4:&lt;/span&gt;         &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="padding-right: 0px; padding-left: 0px; font-size: 8pt; padding-bottom: 0px; margin: 0em; overflow: visible; width: 100%; color: black; direction: ltr; border-top-style: none; line-height: 12pt; padding-top: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; border-right-style: none; border-left-style: none; background-color: white; text-align: left; border-bottom-style: none"&gt;&lt;span id="lnum5" style="color: #606060"&gt;   5:&lt;/span&gt; return View();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This is taken from an MVC project, hence the return value of View(), but I hope you get the idea.&lt;/p&gt;

&lt;p&gt;Now the stored procedure will be executed with any required parameters and the Job entity will hold the data.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7186543" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/qgfoEeoc0VM" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/asp.net/default.aspx">asp.net</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/Entity+Framework/default.aspx">Entity Framework</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/MVC/default.aspx">MVC</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2009/08/31/complex-types-in-the-entity-framework.aspx</feedburner:origLink></item><item><title>LINQ to XML Quick Brain Dump</title><link>http://feedproxy.google.com/~r/GarrysnetBlog/~3/FOmaEbVp-ZY/linq-to-xml-quick-brain-dump.aspx</link><pubDate>Tue, 25 Aug 2009 20:10:00 GMT</pubDate><guid isPermaLink="false">c06e2b9d-981a-45b4-a55f-ab0d8bbfdc1c:7181257</guid><dc:creator>capgpilk</dc:creator><slash:comments>3</slash:comments><wfw:commentRss>http://weblogs.asp.net/garrypilkington/rsscomments.aspx?PostID=7181257</wfw:commentRss><wfw:comment>http://weblogs.asp.net/garrypilkington/commentapi.aspx?PostID=7181257</wfw:comment><comments>http://weblogs.asp.net/garrypilkington/archive/2009/08/25/linq-to-xml-quick-brain-dump.aspx#comments</comments><description>&lt;p&gt;LINQ to XML is a simple toolset that allows developers to easily interact with XML, whether it be in file form of on the wire in string form.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Write to an XML file&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;There are a few methods within the System.Xml.Linq namespace which make this interaction a breeze. The four main ones are:-&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;XDocument – Method which creates the XML document&lt;/li&gt;    &lt;li&gt;XDeclaration – Allows you to set the declaration at the top of the file.&lt;/li&gt;    &lt;li&gt;XElement – Creates a hierarchical element structure&lt;/li&gt;    &lt;li&gt;XAttribute – Creates any attributes related to an element.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The following code shows a very simple way to generate an XML document for members of a club.&lt;/p&gt;  &lt;div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left; max-height: 200px;"&gt;   &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;     &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum1" style="color: rgb(96, 96, 96);"&gt;   1:&lt;/span&gt; Member[] members = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt;[] {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum2" style="color: rgb(96, 96, 96);"&gt;   2:&lt;/span&gt;  &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Member{Age = 33, FullName = &lt;span style="color: rgb(0, 96, 128);"&gt;"John Havers"&lt;/span&gt;, Title = &lt;span style="color: rgb(0, 96, 128);"&gt;"Mr"&lt;/span&gt;},&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum3" style="color: rgb(96, 96, 96);"&gt;   3:&lt;/span&gt;  &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Member{Age = 28, FullName = &lt;span style="color: rgb(0, 96, 128);"&gt;"Robin Southgate"&lt;/span&gt;, Title = &lt;span style="color: rgb(0, 96, 128);"&gt;"Mrs"&lt;/span&gt;},&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum4" style="color: rgb(96, 96, 96);"&gt;   4:&lt;/span&gt;  &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Member{Age = 45, FullName = &lt;span style="color: rgb(0, 96, 128);"&gt;"Paul Chatwell"&lt;/span&gt;, Title = &lt;span style="color: rgb(0, 96, 128);"&gt;"Mr"&lt;/span&gt;},&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum5" style="color: rgb(96, 96, 96);"&gt;   5:&lt;/span&gt;     };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum6" style="color: rgb(96, 96, 96);"&gt;   6:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum7" style="color: rgb(96, 96, 96);"&gt;   7:&lt;/span&gt; XDocument doc = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; XDocument(&lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; XDeclaration(&lt;span style="color: rgb(0, 96, 128);"&gt;"1.0"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"utf-8"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"yes"&lt;/span&gt;),&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum8" style="color: rgb(96, 96, 96);"&gt;   8:&lt;/span&gt;           &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; XElement(&lt;span style="color: rgb(0, 96, 128);"&gt;"members"&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum9" style="color: rgb(96, 96, 96);"&gt;   9:&lt;/span&gt;           from member &lt;span style="color: rgb(0, 0, 255);"&gt;in&lt;/span&gt; members&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum10" style="color: rgb(96, 96, 96);"&gt;  10:&lt;/span&gt;           select &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; XElement(&lt;span style="color: rgb(0, 96, 128);"&gt;"member"&lt;/span&gt;,&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum11" style="color: rgb(96, 96, 96);"&gt;  11:&lt;/span&gt;                  &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; XAttribute(&lt;span style="color: rgb(0, 96, 128);"&gt;"age"&lt;/span&gt;, member.Age),&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum12" style="color: rgb(96, 96, 96);"&gt;  12:&lt;/span&gt;                  &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; XAttribute(&lt;span style="color: rgb(0, 96, 128);"&gt;"title"&lt;/span&gt;, member.Title),&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum13" style="color: rgb(96, 96, 96);"&gt;  13:&lt;/span&gt;                  &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; XElement(&lt;span style="color: rgb(0, 96, 128);"&gt;"fullname"&lt;/span&gt;, member.FullName)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum14" style="color: rgb(96, 96, 96);"&gt;  14:&lt;/span&gt;         )&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum15" style="color: rgb(96, 96, 96);"&gt;  15:&lt;/span&gt;     )&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum16" style="color: rgb(96, 96, 96);"&gt;  16:&lt;/span&gt; );&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum17" style="color: rgb(96, 96, 96);"&gt;  17:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum18" style="color: rgb(96, 96, 96);"&gt;  18:&lt;/span&gt;         doc.Save(&lt;span style="color: rgb(0, 96, 128);"&gt;@"c:\members.xml"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This would generate this XML file.&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left; max-height: 200px;"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum1" style="color: rgb(96, 96, 96);"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;xml&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;version&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="1.0"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;encoding&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="utf-8"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;standalone&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="yes"&lt;/span&gt; ?&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum2" style="color: rgb(96, 96, 96);"&gt;   2:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;members&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum3" style="color: rgb(96, 96, 96);"&gt;   3:&lt;/span&gt;      &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;member&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;age&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="33"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Mr"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum4" style="color: rgb(96, 96, 96);"&gt;   4:&lt;/span&gt;       &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;fullname&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;John Havers&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;fullname&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum5" style="color: rgb(96, 96, 96);"&gt;   5:&lt;/span&gt;      &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;member&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum6" style="color: rgb(96, 96, 96);"&gt;   6:&lt;/span&gt;      &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;member&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;age&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="28"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Mrs"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum7" style="color: rgb(96, 96, 96);"&gt;   7:&lt;/span&gt;       &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;fullname&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;Robin Southgate&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;fullname&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum8" style="color: rgb(96, 96, 96);"&gt;   8:&lt;/span&gt;      &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;member&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum9" style="color: rgb(96, 96, 96);"&gt;   9:&lt;/span&gt;      &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;member&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;age&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="45"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;title&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Mr"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum10" style="color: rgb(96, 96, 96);"&gt;  10:&lt;/span&gt;       &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;fullname&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;Paul Chatwell&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;fullname&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum11" style="color: rgb(96, 96, 96);"&gt;  11:&lt;/span&gt;      &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;member&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum12" style="color: rgb(96, 96, 96);"&gt;  12:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;members&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;b&gt;Reading from an XML file&lt;/b&gt;&lt;/p&gt;

&lt;p&gt;Firstly use the Load method of the XDocument class, then a simple LINQ query will return all elements within the root element like this.&lt;/p&gt;

&lt;div id="codeSnippetWrapper" style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; font-size: 8pt; width: 97.5%; cursor: text; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left; max-height: 200px;"&gt;
  &lt;div id="codeSnippet" style="border-style: none; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;
    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum1" style="color: rgb(96, 96, 96);"&gt;   1:&lt;/span&gt; IEnumerable&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;XElement&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt; q = from c in loaded.Root.Elements("member")&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum2" style="color: rgb(96, 96, 96);"&gt;   2:&lt;/span&gt;                                   select c;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum3" style="color: rgb(96, 96, 96);"&gt;   3:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum4" style="color: rgb(96, 96, 96);"&gt;   4:&lt;/span&gt;         foreach (XElement element in q)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum5" style="color: rgb(96, 96, 96);"&gt;   5:&lt;/span&gt;         {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum6" style="color: rgb(96, 96, 96);"&gt;   6:&lt;/span&gt;             foreach (XElement r in element.Elements())&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum7" style="color: rgb(96, 96, 96);"&gt;   7:&lt;/span&gt;             {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum8" style="color: rgb(96, 96, 96);"&gt;   8:&lt;/span&gt;                 Console.WriteLine(r.Value);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: white; text-align: left;"&gt;&lt;span id="lnum9" style="color: rgb(96, 96, 96);"&gt;   9:&lt;/span&gt;             }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-style: none; margin: 0em; padding: 0px; overflow: visible; font-size: 8pt; width: 100%; color: black; direction: ltr; line-height: 12pt; font-family: 'Courier New',courier,monospace; background-color: rgb(244, 244, 244); text-align: left;"&gt;&lt;span id="lnum10" style="color: rgb(96, 96, 96);"&gt;  10:&lt;/span&gt;         }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This query lists all the elements called ‘member’ within the root. Then for each member element it will again for each through for any elements within those. In our example the members full name is located there, so a simple value output will write the data to the console.&lt;/p&gt;

&lt;p&gt;You can still use var for the query, but during running of the code it is possible to determine the resultant type.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://weblogs.asp.net/blogs/garrypilkington/debug_2CA50182.jpg" mce_href="http://weblogs.asp.net/blogs/garrypilkington/debug_2CA50182.jpg"&gt;&lt;img src="http://weblogs.asp.net/blogs/garrypilkington/debug_thumb_40C0AEBC.jpg" title="debug" style="border: 0px none ; display: inline;" alt="debug" mce_src="http://weblogs.asp.net/blogs/garrypilkington/debug_thumb_40C0AEBC.jpg" width="496" border="0" height="174"&gt;&lt;/a&gt; &lt;/p&gt;

&lt;p&gt;This shows that it is of type&amp;nbsp; XElement and that it is enumerable so you can change var to IENumerable&amp;lt;XElement&amp;gt; to give the code more meaning.&lt;/p&gt;&lt;img src="http://weblogs.asp.net/aggbug.aspx?PostID=7181257" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/GarrysnetBlog/~4/FOmaEbVp-ZY" height="1" width="1"/&gt;</description><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/.NET/default.aspx">.NET</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/C_2300_/default.aspx">C#</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/linq/default.aspx">linq</category><category domain="http://weblogs.asp.net/garrypilkington/archive/tags/SQL/default.aspx">SQL</category><feedburner:origLink>http://weblogs.asp.net/garrypilkington/archive/2009/08/25/linq-to-xml-quick-brain-dump.aspx</feedburner:origLink></item></channel></rss>
