<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>DotNetDevDude - Code</title>
    <link>http://dotnetdevdude.com/Blog/</link>
    <description>Random thoughts, insights, and questions in the world of a .Net dude</description>
    <language>en-us</language>
    <copyright>Keith Burnell</copyright>
    <lastBuildDate>Wed, 19 Dec 2012 17:08:48 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>keith@dotnetdevdude.com</managingEditor>
    <webMaster>keith@dotnetdevdude.com</webMaster>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=4e1993d6-d779-414a-83cf-018ea57feede</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,4e1993d6-d779-414a-83cf-018ea57feede.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,4e1993d6-d779-414a-83cf-018ea57feede.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=4e1993d6-d779-414a-83cf-018ea57feede</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>Asynchronous Operations Come To Entity Framework 6</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,4e1993d6-d779-414a-83cf-018ea57feede.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/12/19/AsynchronousOperationsComeToEntityFramework6.aspx</link>
      <pubDate>Wed, 19 Dec 2012 17:08:48 GMT</pubDate>
      <description>&lt;p&gt;
At BUILD, during &lt;a href="http://channel9.msdn.com/Events/Build/2012/3-031" target="_blank"&gt;this&lt;/a&gt; session
by Entity Framework Program Manager Rowan Miller, Entity Framework 6 beta was announced
and made publicly available. You can get the Entity Framework 6 beta bits via NuGet.
Currently they are only available via the Package Manager Console, more info can be
found on the &lt;a href="http://nuget.org/packages/entityframework" target="_blank"&gt;EF
NuGet page&lt;/a&gt;. 
&lt;/p&gt;
&lt;p&gt;
Entity Framework 6 is the first new version of EF since the announcement earlier this
year that the product would be Open Sourced. This means that not only is the source
available but the builds of EF6 beta are available as soon as the code is checked
in. Entity Framework is hosted on &lt;a href="http://entityframework.codeplex.com/" target="_blank"&gt;CodePlex&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The EF 6 &lt;a href="http://entityframework.codeplex.com/wikipage?title=Roadmap" target="_blank"&gt;roadmap&lt;/a&gt; defines
in detail what is currently in the works and what is still on the board as far as
features and improvements for EF 6. In this post I want to focus on one new addition
to Entity Framework that I find very compelling.
&lt;/p&gt;
&lt;p&gt;
One of the great features introduced in .NET 4.5 was the task-based asynchronous functionality
using the &lt;font color="#000000" face="Consolas"&gt;async&lt;/font&gt;&lt;em&gt; &lt;/em&gt;and &lt;font face="Consolas"&gt;await&lt;/font&gt;&lt;em&gt; &lt;/em&gt;keywords.
Now with EF 6 comes support for asynchronous querying and saving using the same &lt;font color="#000000" face="Consolas"&gt;async&lt;/font&gt;&lt;em&gt; &lt;/em&gt;and &lt;font face="Consolas"&gt;await &lt;/font&gt;coding
convention. Let’s first look at asynchronous querying.
&lt;/p&gt;
&lt;p&gt;
The following asynchronous extension methods have been implemented for querying your
data context and as you’d expect they are the asynchronous versions of their synchronous
namesakes:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
AllAsync 
&lt;li&gt;
AnyAsync 
&lt;li&gt;
AverageAsync 
&lt;li&gt;
ContainsAsync 
&lt;li&gt;
CountAsync 
&lt;li&gt;
FindAsync 
&lt;li&gt;
FirstAsync 
&lt;li&gt;
FirstOrDefaultAsync 
&lt;li&gt;
LoadAsync 
&lt;li&gt;
LongCountAsync 
&lt;li&gt;
MaxAsync 
&lt;li&gt;
MinAsync 
&lt;li&gt;
SingleAsync 
&lt;li&gt;
SingleOrDefaultAsync 
&lt;li&gt;
SumAsync 
&lt;li&gt;
ToArrayAsync 
&lt;li&gt;
ToDictionaryAsync 
&lt;li&gt;
ToListAsync&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
In the code snippet below you can see an example of using the ForEachAsync method
to asynchronously loop through all the manufacturers in my data context and print
them to the console.
&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; async
Task PrintAllManufacturers() {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"&gt;    &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (DataContext
context = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataContext()) {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"&gt;        await context.Manufacturers.ForEachAsync(m =&gt; Console.WriteLine(&lt;span style="color: #006080"&gt;"{0}
: {1}"&lt;/span&gt;, m.Name, m.Country));&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Another piece of Entity Framework functionality that the asynchronous goodness has
been added too is saving. Below is an example of adding a manufacturer and asynchronously
saving the changes.
&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; async
Task AddManufacturer(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; name, &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; country)
{&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"&gt;    &lt;span style="color: #0000ff"&gt;using&lt;/span&gt; (DataContext
context = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataContext()) {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"&gt;        context.Manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Name = name, Country = country});&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"&gt;        await context.SaveChangesAsync();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: white"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-top-style: none; overflow: visible; font-size: 8pt; border-left-style: none; font-family: 'Courier New', courier, monospace; border-bottom-style: none; color: black; padding-bottom: 0px; direction: ltr; text-align: left; padding-top: 0px; border-right-style: none; padding-left: 0px; margin: 0em; line-height: 12pt; padding-right: 0px; width: 100%; background-color: #f4f4f4"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Using the asynchronous pattern is a great way to provide a more responsive user experience
and now loading data asynchronously with Entity Framework has become much easier.
&lt;/p&gt;
&lt;!--CRLF--&gt;&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=4e1993d6-d779-414a-83cf-018ea57feede" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,4e1993d6-d779-414a-83cf-018ea57feede.aspx</comments>
      <category>Code</category>
      <category>Code First</category>
      <category>EF</category>
      <category>Entity Framework</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=60a1cb1f-65f1-47dd-8a47-c74b640d6050</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,60a1cb1f-65f1-47dd-8a47-c74b640d6050.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,60a1cb1f-65f1-47dd-8a47-c74b640d6050.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=60a1cb1f-65f1-47dd-8a47-c74b640d6050</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <title>Kendo UI for ASP.NET MVC: Part 3: Creating a Bundle for the Kendo UI Scripts and Content</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,60a1cb1f-65f1-47dd-8a47-c74b640d6050.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/06/29/KendoUIForASPNETMVCPart3CreatingABundleForTheKendoUIScriptsAndContent.aspx</link>
      <pubDate>Fri, 29 Jun 2012 20:38:27 GMT</pubDate>
      <description>&lt;p&gt;
A great new feature in ASP.NET MVC is the ability to bundle scripts and CSS files
and register them as a group.&amp;nbsp; More detail on this functionality can be found &lt;a href="http://www.asp.net/mvc/tutorials/mvc-4/bundling-and-minification" target="_blank"&gt;here&lt;/a&gt;.&amp;nbsp;
Because by default all the scripts and CSS classes in a new MVC 4 project are registered
using bundles I felt a little dirty in my previous posts referencing my Kendo UI scripts
and CSS files each individually.&amp;nbsp; I rectified that.
&lt;/p&gt;
&lt;p&gt;
So I started the rectification process by adding entries to the &lt;strong&gt;&lt;em&gt;BundleConfig.cs&lt;/em&gt;&lt;/strong&gt;.&amp;nbsp;
In this file is where you create and configure your bundles.&amp;nbsp; Out of the box
there are a number of bundles configured so all I needed to was follow the same conventions
when creating my bundles.&amp;nbsp; 
&lt;/p&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; overflow-x: auto; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" 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: 'Courier New', 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;bundles.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; ScriptBundle(&lt;span style="color: #006080"&gt;"~/bundles/kendojs"&lt;/span&gt;).Include(&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: 'Courier New', 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: #006080"&gt;"~/Scripts/jquery.min.js"&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: 'Courier New', 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: #006080"&gt;"~/Scripts/kendo.all.min.js"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;bundles.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StyleBundle(&lt;span style="color: #006080"&gt;"~/Content/kendocss"&lt;/span&gt;).Include(&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: 'Courier New', 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: #006080"&gt;"~/Content/kendo.common.min.css"&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: 'Courier New', 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: #006080"&gt;"~/Content/kendo.default.min.css"&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Obviously I took the least amount of scripts I needed to get my contrived sample created,
but you can add whatever scripts you need.
&lt;/p&gt;
&lt;p&gt;
After creating the bundles I need to register or “Render” them as the method is called.&amp;nbsp;
Have to admit I am not a fan of “Render” as the method name.&amp;nbsp; In the past “Render”
has always had a visual connotation.&amp;nbsp; The registering of the bundles for this
example is taking place in the &lt;strong&gt;_layout.cs&lt;/strong&gt;, but you could do the same
thing directly in your ASP.NET MVC View.
&lt;/p&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; overflow-x: auto; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" 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: 'Courier New', 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;@Styles.Render([...other CSS bundles], &lt;span style="color: #006080"&gt;"~/Content/kendocss"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;@Scripts.Render([...other Script bundles],&lt;span style="color: #006080"&gt;"~/bundles/kendojs"&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
And that’s it.&amp;nbsp; Now I have my Kendo UI scripts and CSS files registered/referenced/rendered
using the new bundling features of ASP.NET MVC
&lt;/p&gt;
&lt;p&gt;
Code is available on &lt;a href="https://github.com/kburnell/GetStartedWithKendoUI" target="_blank"&gt;GitHub&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=60a1cb1f-65f1-47dd-8a47-c74b640d6050" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,60a1cb1f-65f1-47dd-8a47-c74b640d6050.aspx</comments>
      <category>Code</category>
      <category>Kendo UI</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=3ee0fdb2-3f92-46e6-8ddd-140647d367d8</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,3ee0fdb2-3f92-46e6-8ddd-140647d367d8.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,3ee0fdb2-3f92-46e6-8ddd-140647d367d8.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3ee0fdb2-3f92-46e6-8ddd-140647d367d8</wfw:commentRss>
      <title>Kendo UI for ASP.NET MVC: Part 2–AutoComplete</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,3ee0fdb2-3f92-46e6-8ddd-140647d367d8.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/06/25/KendoUIForASPNETMVCPart2AutoComplete.aspx</link>
      <pubDate>Mon, 25 Jun 2012 12:37:36 GMT</pubDate>
      <description>&lt;p&gt;
&lt;em&gt;Note: If you are following along at home you may have noticed that the number
of the series posts has changed.&amp;nbsp; I have taken some *poetic license* and decided
that the previous post introducing Kendo UI for ASP.NET MVC was actually part part
3 of the original series on Kendo UI &lt;strong&gt;in&lt;/strong&gt; ASP.NET MVC as well as part
1 of a new series on Kendo UI &lt;strong&gt;for&lt;/strong&gt; ASP.NET MVC.&amp;nbsp; Clear as mud,
right?&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
To stay in line, and catch up, with the pre-Kendo UI for ASP.NET MVC series this post
is going to show you how to implement the Kendo UI AutoComplete control using the
HtmlHelper extension.&amp;nbsp; In case you didn’t catch the &lt;a href="http://dotnetdevdude.com/Blog/2012/05/21/KendoUIInASPNETMVCPart2AutoComplete.aspx" target="_blank"&gt;original
post&lt;/a&gt; on implementing the AutoComplete using Kendo UI (core/non-mvc) in ASP.NET
MVC, the Kendo UI AutoComplete control is a text box that has an associated list of
items that when text is entered into it a suggestion list is displayed allowing the
user to select an item.
&lt;/p&gt;
&lt;p&gt;
To get started follow steps 1 - 6 in the &lt;a href="http://dotnetdevdude.com/Blog/2012/06/19/KendoUIInASPNETMVCPart3IntroducingKendoUIForASPNETMVC.aspx" target="_blank"&gt;previous
post&lt;/a&gt; to prep a new solution.
&lt;/p&gt;
&lt;p&gt;
Next I created a server side model: &lt;strong&gt;Manufacturer.cs&lt;/strong&gt;
&lt;/p&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; overflow-x: auto; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" 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: 'Courier New', 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: 'Courier New', 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: #0000ff"&gt;namespace&lt;/span&gt; Part2_AutoComplete.Web.Models&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Manufacturer&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', 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: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;int&lt;/span&gt; Id
{ get; set; }&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: 'Courier New', 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: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Name
{ get; set; }&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
As you can see the view the model is a very simple class that contains only an Id
and a Name field. 
&lt;p&gt;
After that I created my view: &lt;strong&gt;Index.cshtml&lt;/strong&gt;
&lt;/p&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; overflow-x: auto; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" 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: 'Courier New', 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: 'Courier New', 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: #0000ff"&gt;using&lt;/span&gt; Kendo.Mvc.UI&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;@model IEnumerable&amp;lt;Part2_AutoComplete.Web.Models.Manufacturer&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    ViewBag.Title = &lt;span style="color: #006080"&gt;"Kendo
UI for ASP.NET MVC: Part 2 - AutoComplete"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;lt;h2&amp;gt;@ViewBag.Title&amp;lt;/h2&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;@(Html.Kendo().AutoComplete()&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    .Name(&lt;span style="color: #006080"&gt;"manufacturerAutoComplete"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    .DataTextField(&lt;span style="color: #006080"&gt;"Name"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    .BindTo(Model)&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    .Suggest(&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: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    .Filter(FilterType.StartsWith)&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    .Placeholder(&lt;span style="color: #006080"&gt;"Manufacturer..."&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    .DataSource(source =&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            source.Read(read =&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                        read.Action(&lt;span style="color: #006080"&gt;"GetManufacturers"&lt;/span&gt;, &lt;span style="color: #006080"&gt;"Home"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;               }).ServerFiltering(&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Lastly we can code our controller: &lt;strong&gt;HomeController.cs&lt;/strong&gt;
&lt;/p&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; overflow-x: auto; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" 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: 'Courier New', 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: 'Courier New', 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: #0000ff"&gt;namespace&lt;/span&gt; Part2_AutoComplete.Web.Controllers
{&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&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: 'Courier New', 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: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; HomeController
: Controller {&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&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: 'Courier New', 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: #0000ff"&gt;public&lt;/span&gt; ActionResult
Index() {&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: 'Courier New', 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: #0000ff"&gt;return&lt;/span&gt; View(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;Manufacturer&amp;gt;
{&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer {Id = 1, Name = &lt;span style="color: #006080"&gt;"Aston
Martin"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        [HttpGet]&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: 'Courier New', 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: #0000ff"&gt;public&lt;/span&gt; JsonResult
GetManufacturers() {&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: 'Courier New', 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: #0000ff"&gt;string&lt;/span&gt; searchValue
= Request.Params[&lt;span style="color: #006080"&gt;"filter[filters][0][value]"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            IList&amp;lt;Manufacturer&amp;gt; manufacturers = BuildManufacturersList().Where(x =&amp;gt; x.Name.StartsWith(searchValue, StringComparison.InvariantCultureIgnoreCase)).ToList();&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: 'Courier New', 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: #0000ff"&gt;return&lt;/span&gt; Json(manufacturers,
JsonRequestBehavior.AllowGet);&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;nbsp;&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: 'Courier New', 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: #0000ff"&gt;private&lt;/span&gt; IEnumerable&amp;lt;Manufacturer&amp;gt;
BuildManufacturersList() {&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            IList&amp;lt;Manufacturer&amp;gt; manufacturers = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;Manufacturer&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 1, Name = &lt;span style="color: #006080"&gt;"Aston Martin"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 2, Name = &lt;span style="color: #006080"&gt;"Audi"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 3, Name = &lt;span style="color: #006080"&gt;"Buggati"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 4, Name = &lt;span style="color: #006080"&gt;"BMW"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 5, Name = &lt;span style="color: #006080"&gt;"Chevrolet"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 6, Name = &lt;span style="color: #006080"&gt;"Ferrari"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 7, Name = &lt;span style="color: #006080"&gt;"Ford"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 8, Name = &lt;span style="color: #006080"&gt;"Lamborghini"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 9, Name = &lt;span style="color: #006080"&gt;"Mazda"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 10, Name = &lt;span style="color: #006080"&gt;"McLaren"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 11, Name = &lt;span style="color: #006080"&gt;"Mercedes Benz"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            manufacturers.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Manufacturer
{Id = 12, Name = &lt;span style="color: #006080"&gt;"Porsche"&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: 'Courier New', 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: #0000ff"&gt;return&lt;/span&gt; manufacturers;&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; 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; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
That’s it.&amp;nbsp; Now that we are caught up with the transition to Kendo UI &lt;strong&gt;for&lt;/strong&gt; ASP.NET
MVC in the next post we can move on to something fresh and new…and Kendo UI certainly
has a lot to offer in that area!
&lt;/p&gt;
&lt;p&gt;
The code is available on &lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=cdab018a-fbb5-42f6-8e62-cf866aa6cc13&amp;amp;url=https%3a%2f%2fgithub.com%2fkburnell%2fGetStartedWithKendoUI"&gt;GitHub&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=3ee0fdb2-3f92-46e6-8ddd-140647d367d8" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,3ee0fdb2-3f92-46e6-8ddd-140647d367d8.aspx</comments>
      <category>Code</category>
      <category>Kendo UI</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=9f136045-5d0e-441d-8c22-dff252e82271</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,9f136045-5d0e-441d-8c22-dff252e82271.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,9f136045-5d0e-441d-8c22-dff252e82271.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=9f136045-5d0e-441d-8c22-dff252e82271</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <title>Kendo UI in ASP.NET MVC: Part 3–Introducing Kendo UI for ASP.NET MVC</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,9f136045-5d0e-441d-8c22-dff252e82271.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/06/19/KendoUIInASPNETMVCPart3IntroducingKendoUIForASPNETMVC.aspx</link>
      <pubDate>Tue, 19 Jun 2012 16:15:53 GMT</pubDate>
      <description>&lt;p&gt;
Back in April I started a series of &lt;a href="http://dotnetdevdude.com/Blog/CategoryView,category,KendoUI.aspx" target="_blank"&gt;posts&lt;/a&gt; related
to using Kendo UI in ASP.NET MVC.&amp;nbsp; Last month the Kendo team released the first
beta of &lt;a href="http://www.kendoui.com/faq/mvc-faq.aspx" target="_blank"&gt;Kendo UI
for ASP.NET MVC&lt;/a&gt;.&amp;nbsp; So, long story short the blog posts on Kendo UI will continue
but from this point forward they will move from implementing Kendo UI proper in ASP.NET
MVC to using Kendo UI for ASP.NET MVC.
&lt;/p&gt;
&lt;p&gt;
Kendo UI for ASP.NET MVC includes the complete Kendo UI suite (&lt;a href="http://www.kendoui.com/web.aspx" target="_blank"&gt;Web&lt;/a&gt;, &lt;a href="http://www.kendoui.com/mobile.aspx" target="_blank"&gt;Mobile&lt;/a&gt;, &lt;a href="http://www.kendoui.com/dataviz.aspx" target="_blank"&gt;DataViz&lt;/a&gt;)
plus a set .NET wrappers to be used with ASP.NET MVC that leverage exciting features
of MVC such as data annotations, editor/display templates and validation.&amp;nbsp; Those
of you still using the WebForms view engine are safe,&amp;nbsp; the wrappers work in both
the Razor view engine and the WebForms view engine.
&lt;/p&gt;
&lt;p&gt;
To get started &lt;a href="http://www.kendoui.com/get-kendo-ui.aspx" target="_blank"&gt;download&lt;/a&gt; the
Kendo UI for ASP.NET MVC bits and install them.&amp;nbsp; The bits include, what I would
call, the Kendo UI core features plus all the ASP.NET MVC specific features so there
is no need install both Kendo UI and Kendo UI for ASP.NET MVC.&amp;nbsp; If you already
have Kendo UI core installed, don’t worry, the installer will adjust accordingly.
&lt;/p&gt;
&lt;p&gt;
Once installed pull up the install location, for me it is “C:\Program Files (x86)\Telerik\Kendo
UI for ASP.NET MVC Q2 2012 BETA”, and play around with the example projects by running
“\Examples\StartExamples.exe”.
&lt;/p&gt;
&lt;p&gt;
Now…let’s get it up and running in an ASP.NET MVC project.
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;em&gt;NOTE: The Kendo UI for ASP.NET MVC documentation states that both MVC 3 and MVC
4 are supported even though the actual Kendo.MVC.dll resides in the “Mvc3” directory.&lt;/em&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;ol&gt;
&lt;li style="margin-bottom: 5px"&gt;
Create a new ASP.NET MVC 3 or 4 project 
&lt;li style="margin-bottom: 5px"&gt;
Add a reference to: [Kendo UI Directory]&lt;strong&gt;\Binaries\Mvc3\Kendo.Mvc.dll&lt;/strong&gt; 
&lt;li style="margin-bottom: 5px"&gt;
Copy the contents of [Kendo UI Directory]&lt;strong&gt;\Scripts&lt;/strong&gt; to the &lt;strong&gt;Scripts&lt;/strong&gt; folder
of your MVC project 
&lt;li style="margin-bottom: 5px"&gt;
Copy the contents of [Kendo UI Directory]&lt;strong&gt;\Content &lt;/strong&gt;to the &lt;strong&gt;Content&lt;/strong&gt; folder
of your MVC project 
&lt;li style="margin-bottom: 5px"&gt;
Reference the Kendo UI scripts and and CSS files in your layout page.&lt;br&gt;
&lt;em&gt;*Note: &lt;a href="http://dotnetdevdude.com/Blog/2012/06/29/KendoUIForASPNETMVCPart3CreatingABundleForTheKendoUIScriptsAndContent.aspx" target="_blank"&gt;If
your using ASP.NET MVC 4 I suggest creating a bundler package&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; overflow-x: auto; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" 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: 'Courier New', 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;lt;link rel=&lt;span style="color: #006080"&gt;"stylesheet"&lt;/span&gt; href=&lt;span style="color: #006080"&gt;"@Url.Content("&lt;/span&gt;~/Content/kendo.common.min.css&lt;span style="color: #006080"&gt;")"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;lt;link rel=&lt;span style="color: #006080"&gt;"stylesheet"&lt;/span&gt; href=&lt;span style="color: #006080"&gt;"@Url.Content("&lt;/span&gt;~/Content/kendo.&lt;span style="color: #0000ff"&gt;default&lt;/span&gt;.min.css&lt;span style="color: #006080"&gt;")"&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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;lt;script src=&lt;span style="color: #006080"&gt;"@Url.Content("&lt;/span&gt;~/Scripts/jquery.min.js&lt;span style="color: #006080"&gt;")"&lt;/span&gt;&amp;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: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;lt;script src=&lt;span style="color: #006080"&gt;"@Url.Content("&lt;/span&gt;~/Scripts/kendo.web.min.js&lt;span style="color: #006080"&gt;")"&lt;/span&gt;&amp;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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;lt;script src=&lt;span style="color: #006080"&gt;"@Url.Content("&lt;/span&gt;~/Scripts/kendo.aspnetmvc.min.js&lt;span style="color: #006080"&gt;")"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/em&gt; 
&lt;li style="margin-bottom: 5px"&gt;
Add a reference to the Kendu.Mvc.UI namespace to the &amp;lt;namespaces&amp;gt; section of
the web.config to allow your views to know about the Kendo HTML Helper extensions. 
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; overflow-x: auto; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" 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: 'Courier New', 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;lt;add &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;=&lt;span style="color: #006080"&gt;"Kendo.Mvc.UI"&lt;/span&gt;/&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;li style="margin-bottom: 5px"&gt;
Let’s test it out.&amp;nbsp; Open up Index.cshtml and create a Kendo UI control using
the new HTML Helpers.&lt;br&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; overflow-x: auto; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: 'Courier New', courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" 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: 'Courier New', 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: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;@(Html.Kendo().DatePicker().Name(&lt;span style="color: #006080"&gt;"MyTestDatePicker"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Kendo-UI.NET-MVC-Part-3Introducing-Kendo_61DC/image_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Kendo-UI.NET-MVC-Part-3Introducing-Kendo_61DC/image_thumb.png" width="497" height="347"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;em&gt;&lt;/em&gt;
&lt;/p&gt;
&lt;p&gt;
As with the previous parts of the series the code is available on &lt;a href="https://github.com/kburnell/GetStartedWithKendoUI" target="_blank"&gt;GitHub&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=9f136045-5d0e-441d-8c22-dff252e82271" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,9f136045-5d0e-441d-8c22-dff252e82271.aspx</comments>
      <category>Code</category>
      <category>jQuery</category>
      <category>Kendo UI</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=466368da-272e-4949-9bdb-a682ee93d587</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,466368da-272e-4949-9bdb-a682ee93d587.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,466368da-272e-4949-9bdb-a682ee93d587.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=466368da-272e-4949-9bdb-a682ee93d587</wfw:commentRss>
      <slash:comments>12</slash:comments>
      <title>Getting Started with Kendo UI in ASP.NET MVC</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,466368da-272e-4949-9bdb-a682ee93d587.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/04/30/GettingStartedWithKendoUIInASPNETMVC.aspx</link>
      <pubDate>Mon, 30 Apr 2012 19:01:26 GMT</pubDate>
      <description>&lt;p&gt;
I have recently started diving in to Kendo UI and have decided to document that dive
and blog about it. So this is the first post in a series dedicated to using Kendo
UI in ASP.NET MVC.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.kendoui.com/"&gt;Kendo UI&lt;/a&gt; is a JavaScript toolset developed by
Telerik that leverages jQuery, HTML5, CSS3, and JavaScript to provide rich UI widgets
and an MVVM framework that is ‘scary fast’. The thing that really drew me to Kendo
UI in the first place is there native skinning on mobile devices. Unlike vanilla jQuery
Mobile that renders the same iOS-esque view on all mobile devices Kendo UI Mobile
applies specific native-looking styles for iOS, Android, and Blackberry. Over the
series of posts I have planned we will cover exactly what Kendo UI brings to the table
for both the ‘desktop’ web and the mobile web, but today I will cover getting Kendo
UI installed and configured in an ASP.NET MVC application.
&lt;/p&gt;
&lt;p&gt;
Before we dive in to getting the bits I want to prepare you…Kendo UI is not free.
I know, I was surprised by this as well and it actually delayed my dive in to it for
a bit. In all honesty I am still not 100% sure how I feel about it not being free.
What I do know is that as a long time user of Telerik products they produce damn good
tooling and there support system is second to none. If you want to just play around
with Kendo UI there is a 60-day free trial available.
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Update:&lt;/strong&gt; I received a comment from a member of the KendoUI team, thanks
John, and my statement above needs some clarification. Kendo UI is dual licensed (GPLv3
and commercial), so although it is not free for commercial use they do support open
source development. You can can get the official terms here: &lt;a href="http://www.kendoui.com/get-kendo-ui.aspx"&gt;http://www.kendoui.com/get-kendo-ui.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Note: To prepare for experimenting with KendoUI I created an empty MVC 4 project,
that of course is not empty, and removed all scirpt and css files (other than Site.css).
I then removed all script and css registrations in _Layout.cshtml. I did this because
I wanted to deal strictly with KendoUI without all the other *noise* of the other
script references. 
&lt;/p&gt;
&lt;p&gt;
You can download the KendoUI bits here: &lt;a href="http://www.kendoui.com/get-kendo-ui.aspx"&gt;http://www.kendoui.com/get-kendo-ui.aspx&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Once downloaded and unzipped copy the contents of the ‘js’ directory to the ‘Scripts’
directory of your ASP.NET MVC application and the contents of the ‘styles’ directory
to the ‘Content’ directory. 
&lt;/p&gt;
&lt;p&gt;
Next you need to register the scripts and CSS files that Kendo UI needs in the _Layout.cshtml.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3b14d332-c509-4fd3-8f26-c7df563741fb" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;_Layout.cshtml
&lt;/div&gt;
&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;!&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;DOCTYPE&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;html&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;html&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;head&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;meta&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;charset&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"utf-8"&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;/&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;meta&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;name&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"viewport"&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;content&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"width=device-width"&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;/&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;title&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;&lt;span style="background:#ffff64;color:#000000"&gt;@&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;ViewBag&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;Title&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;title&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;script&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;src&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"~/Scripts/jquery.min.js"&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;/span&gt;&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;script&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;script&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;src&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"~/Scripts/kendo.all.min.js"&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;/span&gt;&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;script&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;link&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;href&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"~/Content/kendo.common.min.css"&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;rel&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"stylesheet"&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;type&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"text/css"&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;/&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;link&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;href&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"~/Content/kendo.default.min.css"&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;rel&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"stylesheet"&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;type&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"text/css"&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;/&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;head&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;body&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#ffff64;color:#000000"&gt;@&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;RenderBody&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;()&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;body&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;html&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;span style="background: #000000; color: #ffd62f"&gt;That’s
it. Kendo UI is now wired up. Pretty much the same process as wiring up jQuery. So
now we can do a quick implementation to prove it.
&lt;/p&gt;
&lt;p&gt;
If you followed my lead and created an empty project you you will need to create a
controller and a view at this point.
&lt;/p&gt;
&lt;p&gt;
The actual implementation of KendoUI is almost identical to that of jQuery which makes
the ramp up time a lot less if you are familiar with jQuery.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ee9dc595-0bff-4cf4-9896-e0d2f376f34b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Index.cshtml
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="background:#ffff64;color:#000000"&gt;@{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;ViewBag&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;Title&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ff3264"&gt;"Getting
Started With KendoUI - Installation and Configuration"&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;script&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;type&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"text/javascript"&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;$&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;(&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;document&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;).&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;ready&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;(&lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;function&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;(){&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;$&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;(&lt;/span&gt;&lt;span style="background:#000000;color:#ff3264"&gt;"#datePicker"&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;).&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;kendoDatePicker&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;}&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;script&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;h2&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;&lt;span style="background:#ffff64;color:#000000"&gt;@&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;ViewBag&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;Title&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;h2&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;input&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;id&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;"datePicker"&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;/&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;/span&gt;&lt;/span&gt; 
&lt;p&gt;
&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;span style="background: #000000; color: #ffd62f"&gt;As
you can see on line 13 I have an input tag with and id of datepicker and then starting
on line 5 I have my document ready function that selects the control with id of datepicker
and calls the ‘kendoDatePicker’ function it. The result is below.&lt;/span&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;span style="background: #000000; color: #ffd62f"&gt;&lt;span style="background: #000000; color: #ffd62f"&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.dotnetdevdude.com/images/kendoUICalendar.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="KendoUI Calendar" border="0" alt="KendoUI Calendar" src="http://www.dotnetdevdude.com/images/kendoUICalendar.png" width="859" height="464"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In the next installment we will dig deeper into the different controls available in
Kendo UI.
&lt;/p&gt;
&lt;p&gt;
If you want to follow along with the source code it is available on &lt;a href="https://github.com/kburnell/GetStartedWithKendoUI"&gt;GitHub&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=466368da-272e-4949-9bdb-a682ee93d587" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,466368da-272e-4949-9bdb-a682ee93d587.aspx</comments>
      <category>Code</category>
      <category>jQuery</category>
      <category>Kendo UI</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=3434e7fd-07d3-4362-b021-c61e00480299</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,3434e7fd-07d3-4362-b021-c61e00480299.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,3434e7fd-07d3-4362-b021-c61e00480299.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3434e7fd-07d3-4362-b021-c61e00480299</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <title>ASP.NET MVC: Putting Your Controllers In A Separate Assembly</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,3434e7fd-07d3-4362-b021-c61e00480299.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/04/23/ASPNETMVCPuttingYourControllersInASeparateAssembly.aspx</link>
      <pubDate>Mon, 23 Apr 2012 13:02:14 GMT</pubDate>
      <description>&lt;p&gt;
Having been a part of many large enterprise ASP.NET MVC application implementations
using test driven development I learned early on that separating your controller classes
into a their own project significantly reduces the noise in your web project.&amp;nbsp;
It wasn’t until a recent talk I gave to user group in my region that I realized that
this isn’t a widely adopted practice.&amp;nbsp; For large applications with a lot of developers
and a complex architecture I highly recommend it.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Putting your controllers in a separate assembly is very straight forward.&amp;nbsp; First
create a controllers project in your solution and then you just need to update your
route registrations to tell them where to look for the controllers.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:63a03047-3b00-4062-9217-044b757bd142" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol start="1" style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#dddddd"&gt;routes&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;MapRoute&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;(&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;name&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;: &lt;/span&gt;&lt;span style="background:#000000;color:#ff3264"&gt;&amp;quot;Default&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;url&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;: &lt;/span&gt;&lt;span style="background:#000000;color:#ff3264"&gt;&amp;quot;{controller}/{action}/{id}&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;, &lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;namespaces&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;: &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;[]
{&lt;/span&gt;&lt;span style="background:#000000;color:#ff3264"&gt;&amp;quot;[Namespace of the Project
that contains your controllers]&amp;quot;}&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;, &lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#f07800"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;defaults&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;: &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; {&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;controller&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ff3264"&gt;&amp;quot;Home&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;action&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ff3264"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;id&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#02e836"&gt;UrlParameter&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="background:#000000;color:#dddddd"&gt;Optional}&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
In order to tell ASP.NET MVC where to look for your controllers when registering your
routes you use the ‘namespaces’ parameter of the MapRoute method as illustrated above.
&lt;/p&gt;
&lt;p&gt;
I know that the concept of putting controllers in a separate assembly is a bit controversial
and everyone seems to have a strong opinion either for or against, so let me know
what side of the fence you fall on.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=3434e7fd-07d3-4362-b021-c61e00480299" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,3434e7fd-07d3-4362-b021-c61e00480299.aspx</comments>
      <category>Best Practice</category>
      <category>Code</category>
      <category>MVC</category>
      <category>MVC3</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=2e129120-27c8-4c6d-a76b-dcb5e4766ca9</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,2e129120-27c8-4c6d-a76b-dcb5e4766ca9.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,2e129120-27c8-4c6d-a76b-dcb5e4766ca9.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2e129120-27c8-4c6d-a76b-dcb5e4766ca9</wfw:commentRss>
      <title>Updated: Unit Test ReSharper Live Templates</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,2e129120-27c8-4c6d-a76b-dcb5e4766ca9.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/04/16/UpdatedUnitTestReSharperLiveTemplates.aspx</link>
      <pubDate>Mon, 16 Apr 2012 12:09:59 GMT</pubDate>
      <description>&lt;p&gt;
Back in 2009 I published &lt;a href="http://dotnetdevdude.com/Blog/2009/07/18/ReSharperLiveTemplateForCreatingUnitTestStub.aspx"&gt;ReSharper
Live Template For Creating Unit Test Stub&lt;/a&gt;.&amp;nbsp; A lot of things have changed
since 2009, including my templates.&amp;nbsp; Since I am doing another series of presentations
on Test Driven Development I thought I should get these out because people always
ask for them.
&lt;/p&gt;
&lt;p&gt;
As stated in my original post these templates are a way for you to create unit test
names that help in describing the true intentions of the test and also to provide
a common unit test format that will make reading and comprehending your unit tests
easier on everyone.&amp;nbsp; And of course as lazy developers any redundancies should
be automated! 
&lt;/p&gt;
&lt;p&gt;
The first template is for a unit test that does not have specific input criteria.&lt;br&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:070f0473-129f-4216-aa50-104d67ce1eb7" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Test
w/out Input Criteria
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol start="1" style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[TestMethod]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;public void $MethodUnderTest$_Should_$ExpectedResult$()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;//Arrange&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#00008b"&gt;$END$&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;//Act&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;//Assert&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The second template is for a unit test that has specific input criteria.&lt;br&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b8ebfa9e-d38c-41b6-b2cb-8e9d911c9660" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Test
with Input Criteria
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol start="1" style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[TestMethod]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;public void $MethodUnderTest$_Should_$ExpectedResult$_When_$Condition$()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;//Arrange&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#00008b"&gt;$END$&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;//Act&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;//Assert&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
You can take the two templates and create new Live Templates and map to whatever key
stroke combination you wish.&amp;nbsp; I use ‘tt’ and ‘tw’.
&lt;/p&gt;
&lt;p&gt;
Note:&amp;nbsp; I have been using these Live Templates since ReSharper 3 and I am currently
using them in the latest build of ReSharper 6 without any issues so you should be
good to go.
&lt;/p&gt;
&lt;p&gt;
As always if you feel these can be improved on or have other Live Templates you want
to share let me know in the comments below.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=2e129120-27c8-4c6d-a76b-dcb5e4766ca9" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,2e129120-27c8-4c6d-a76b-dcb5e4766ca9.aspx</comments>
      <category>Code</category>
      <category>ReSharper</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=204be37e-0a0c-4918-8324-39d850569f34</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,204be37e-0a0c-4918-8324-39d850569f34.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,204be37e-0a0c-4918-8324-39d850569f34.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=204be37e-0a0c-4918-8324-39d850569f34</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>Make your web site more accessible to mobile devices with a single line of mark-up</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,204be37e-0a0c-4918-8324-39d850569f34.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/02/06/MakeYourWebSiteMoreAccessibleToMobileDevicesWithASingleLineOfMarkup.aspx</link>
      <pubDate>Mon, 06 Feb 2012 14:15:38 GMT</pubDate>
      <description>&lt;p&gt;
I have been working a lot with MVC sites lately and experimenting with how to make
them *usable* on mobile browsers.&amp;nbsp; This is post is about the single line of mark-up
you can add to your sites Master Page, or in this case your _Layout.cshtml. 
&lt;/p&gt;
&lt;p&gt;
Before I get to that line I am going to show you a quick screen shot of a vanilla
MVC 3 application, that can be &lt;a href="http://www.dotnetdevdude.com/downloads/code/DreamCarsMVC3.zip" target="_blank"&gt;downloaded
here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
First is a screen shot of the site running in a desktop browser.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/Before_Desktop.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/Before_Desktop.png" width="672" height="511"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Next, is the site rendered on Windows Phone 7, Android, and iPhone.
&lt;/p&gt;
&lt;table border="0" cellspacing="10" cellpadding="20" width="1014"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="333"&gt;
&lt;p align="center"&gt;
&lt;font size="3"&gt;Windows Phone 7&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="313"&gt;
&lt;p align="center"&gt;
&lt;font size="3"&gt;Opera Mobile (Android)&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="326"&gt;
&lt;p align="center"&gt;
&lt;font size="3"&gt;iPhone&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="333"&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/Before_WP7.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/Before_WP7.png" width="290" height="545"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="313"&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/Before_Android.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/Before_Android.png" width="270" height="418"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="326"&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/Before_iPhone.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/Before_iPhone.png" width="283" height="544"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
The first thing you notice is that iOS does a fairly good job adaptively rendering
the site, damn Apple!&amp;nbsp; Next you will notice that all WP7 and Android do is zoom
out so the site fits on the device.&amp;nbsp; A site of any significant content or functionality
would be almost useless because of the amount of panning and zooming that would be
required.&amp;nbsp; I am sure we have all dealt with sites on our mobile devices like
that.&amp;nbsp; So what can we do to make the site render better in WP7 and Android?
&lt;/p&gt;
&lt;p&gt;
You can actually get a long way towards perfect mobile rendering of your site by adding
one simple html tag.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cb4a1b91-6f4f-4f6c-bad5-2778dde6ddef" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#ffd62f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;meta&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;name&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;&amp;quot;viewport&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The meta viewport tag can be used to control how HTML content is displayed in mobile
browsers.&amp;nbsp; The meta viewport tag has properties like width, height, minimum-scale,
and maximum-scale.&amp;nbsp; In this example the particular property we are concerned
with is the width property.&amp;nbsp; We want to tell the the browser to render our content
width at the width of device.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:bd2d5ee3-f21c-4950-bfac-1d79b6387138" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="background:#000000;color:#ffd62f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#ebebeb"&gt;meta&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;name&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;&amp;quot;viewport&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#f07800"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#5ebbd7"&gt;content&lt;/span&gt;&lt;span style="background:#000000;color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="background:#000000;color:#58ff2f"&gt;&amp;quot;width=device-width&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Let’s see what happens when we add that tag to the head of our _Layout.cshtml file
&lt;/p&gt;
&lt;p&gt;
&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/After_Desktop.png" width="672" height="463"&gt;
&lt;/p&gt;
&lt;p&gt;
As you can see above, because the meta viewport tag only effects mobile browsers our
desktop version looks exactly the same.&amp;nbsp; Let’s check on the mobile browsers.
&lt;/p&gt;
&lt;table border="0" cellspacing="10" cellpadding="20" width="1014"&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td valign="top" width="333"&gt;
&lt;p align="center"&gt;
&lt;font size="3"&gt;Windows Phone 7&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="313"&gt;
&lt;p align="center"&gt;
&lt;font size="3"&gt;Opera Mobile (Android)&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;td valign="top" width="326"&gt;
&lt;p align="center"&gt;
&lt;font size="3"&gt;iPhone&lt;/font&gt;
&lt;/p&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top" width="333"&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/After_WP7.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/After_WP7.png" width="294" height="548"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="313"&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/After_Android.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/After_Android.png" width="273" height="418"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;td valign="top" width="326"&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/After_iPhone.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ViewPortMetaTag/After_iPhone.png" width="283" height="548"&gt;&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;p&gt;
The site looks much better on Windows Phone 7 and Android, and still looks the same
in Apple.&amp;nbsp; So by adding that single line of mark-up we where able to give our
mobile users a much better user experience.
&lt;/p&gt;
&lt;p&gt;
Stay tuned for a future post on using CSS Media Queries to improve the mobile experience
even further.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=204be37e-0a0c-4918-8324-39d850569f34" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,204be37e-0a0c-4918-8324-39d850569f34.aspx</comments>
      <category>Code</category>
      <category>Mobile</category>
      <category>MVC</category>
      <category>MVC3</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=6c46c31a-8608-4769-b684-9aab889ca6a2</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,6c46c31a-8608-4769-b684-9aab889ca6a2.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,6c46c31a-8608-4769-b684-9aab889ca6a2.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6c46c31a-8608-4769-b684-9aab889ca6a2</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <title>Entity Framework Code First Spatial Data</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,6c46c31a-8608-4769-b684-9aab889ca6a2.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/01/23/EntityFrameworkCodeFirstSpatialData.aspx</link>
      <pubDate>Mon, 23 Jan 2012 14:30:40 GMT</pubDate>
      <description>&lt;p&gt;
Support for spatial data was introduced in &lt;a href="http://msdn.microsoft.com/en-us/magazine/dd434647.aspx" target="_blank"&gt;SQL
Server 2008&lt;/a&gt;.&amp;nbsp; What this allows you to do is capture data related to 2D geometric
or geographical images in SQL Server.&amp;nbsp; It actually allows you to do much more
than just storing a bunch of numbers representing this data.&amp;nbsp; In the initial
releases of Entity Framework the spatial data type was not available for use, but
with the &lt;a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=26660" target="_blank"&gt;Entity
Framework June 2011 CTP&lt;/a&gt; release this functionality is now available.
&lt;/p&gt;
&lt;p&gt;
I am once again working with the &lt;a href="https://github.com/kburnell/EFCodeFirstDemo" target="_blank"&gt;code&lt;/a&gt; from
my &lt;a href="http://dotnetdevdude.com/Blog/CommentView,guid,f70511b3-3b14-4e81-87c8-5b93cb617804.aspx" target="_blank"&gt;Entity
Framework Code First Demo&lt;/a&gt; post.&amp;nbsp; This simple application is dream car tracker
that tracks manufacturers and models of cars that someday I would love to own.&amp;nbsp;
As part of the manufacturer data I currently store the Country but would like to be
able to map out the corporate headquarters for the day when I get to take a trip and
take delivery.&amp;nbsp; I am able to retrieve the latitude and longitude from Google
Maps by knowing the address.
&lt;/p&gt;
&lt;p&gt;
The Ferrari factory located at: Via Abetone Inferiore n. 4, I-41053 Maranello Italy
has a latitude and longitude of 44.53244, 10.86412.&amp;nbsp; At this point if you are
new to the spatial data type, like I was, you are probably thinking “that is just
a decimal and you could always store decimals in SQL Server” and you are correct.&amp;nbsp;
I could certainly just add two decimal properties to my model that represent latitude
and longitude and go on my merry way but using spatial data functionality introduced
in the June CTP I get so much more.
&lt;/p&gt;
&lt;p&gt;
Because I am dealing with geographical data and not geometric data I am going to use
the DbGeography type, that can be found in System.Data.Spatial, and add a Location
property to my Manufacturer model.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9ceb4b9d-cf5e-47f1-b5f0-a2aaa56f5b7a" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div class="le-pavsc-titleblock"&gt;Manufacturer.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;long&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ManufacturerId&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;StringLength&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff4aff"&gt;40&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;StringLength&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff4aff"&gt;40&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Country&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Location&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#5ebbd7"&gt;#region&lt;/span&gt;&lt;span style="color:#f07800"&gt; &amp;lt;&amp;lt; Navigation
Properties &amp;gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;virtual&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Model&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Models&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#5ebbd7"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Once I have Entity Framework Code First regenerate my database I can take a look and
see that the .NET Framework type DbGeography translates to the SQL Server type Geography.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Entity-Framework-Spatial-Data-Type_901A/image_4.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Entity-Framework-Spatial-Data-Type_901A/image_thumb_1.png" width="323" height="432"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Now that I have my property I can populate the Location data by converting my latitude
and longitude values to a DbGeography using the static parse method.&amp;nbsp; I can add
this to my SeedManufacturer method.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ce80bab3-8561-4820-b9af-f5f67e85ba09" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;SeedManufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#02e836"&gt;DataContext&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;context&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_ferrari&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Ferrari&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Country&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Italy&amp;quot;}&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_lamborghini&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Lamborghini&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Country&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Italy&amp;quot;}&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_astonMartin&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Aston
Martin&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Country&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;United
Kingdom&amp;quot;}&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_porsche&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Porsche&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Country&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Germany&amp;quot;}&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_ferrari&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Location&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Parse&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;POINT(44.53244
10.86412)&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_lamborghini&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Location&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Parse&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;POINT
(44.65934 11.12693)&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_astonMartin&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Location&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Parse&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;POINT
(52.18708 -1.48351)&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_porsche&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Location&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Parse&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;POINT
(48.83498 9.15231)&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;List&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_ferrari&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_lamborghini&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_astonMartin&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_porsche}&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ForEach&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;context&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Manufacturers&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Add&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt;));&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Now if you look at the data in SQL Server you an see that the data is now represented
as a nasty looking hex.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Entity-Framework-Spatial-Data-Type_901A/image_6.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Entity-Framework-Spatial-Data-Type_901A/image_thumb_2.png" width="591" height="146"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
I know you are still wondering what the point is, pun intended!&amp;nbsp; Well, now I
can get to the cool part.&amp;nbsp; I can use the methods that come along with DbGeography
to do things such as getting distance between two manufacturers as illustrated below
in line 3.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:041a36d6-bf0f-4268-a2df-56ab89004570" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div class="le-pavsc-titleblock"&gt;
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ferrari&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;dc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Manufacturers&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;First&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;==&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Ferrari&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;lamborghini&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;dc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Manufacturers&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;First&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;==&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Lamborghini&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;double&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;distanceInKilometers&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ferrari&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Location&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Distance&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;lamborghini&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Location&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#5ebbd7"&gt;double&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;distanceInMiles&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;distanceInKilometers&lt;/span&gt;&lt;span style="color:#ffff00"&gt;/&lt;/span&gt;&lt;span style="color:#ff4aff"&gt;1609.344&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;outputText&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Format&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;{&lt;/span&gt;&lt;span style="color:#3cb371"&gt;0}&lt;/span&gt;&lt;span style="color:#ff3264"&gt; is
{&lt;/span&gt;&lt;span style="color:#3cb371"&gt;1}&lt;/span&gt;&lt;span style="color:#ff3264"&gt; miles from
{&lt;/span&gt;&lt;span style="color:#3cb371"&gt;2}&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ferrari&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;distanceInMiles&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;lamborghini&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
You can also use the methods in LINQ.&amp;nbsp; The query below finds all the manufacturers
that are within a 100 mile radius of my house.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4da8c71c-9a83-4a0f-a66e-ab74a5575ab7" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;myHouse&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Parse&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;POINT
(4.65934 1.12693)&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;closeToMe&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;manufacturers&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Where&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Location&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Distance&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;myHouse&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;&lt;span style="color:#ffff00"&gt;*&lt;/span&gt;&lt;span style="color:#ff4aff"&gt;.00062&lt;/span&gt;&lt;span style="color:#f07800"&gt;) &lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff4aff"&gt;100&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ToList&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=6c46c31a-8608-4769-b684-9aab889ca6a2" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,6c46c31a-8608-4769-b684-9aab889ca6a2.aspx</comments>
      <category>Code</category>
      <category>Code First</category>
      <category>EF</category>
      <category>Entity Framework</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=a842a512-d914-4da0-b622-4af3d9800ed2</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,a842a512-d914-4da0-b622-4af3d9800ed2.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,a842a512-d914-4da0-b622-4af3d9800ed2.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a842a512-d914-4da0-b622-4af3d9800ed2</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <title>Entity Framework Code First Enum</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,a842a512-d914-4da0-b622-4af3d9800ed2.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2012/01/09/EntityFrameworkCodeFirstEnum.aspx</link>
      <pubDate>Mon, 09 Jan 2012 14:18:40 GMT</pubDate>
      <description>&lt;p&gt;
The most requested feature for Entity Framework has been Enum support for a very long
time.&amp;nbsp; At TechEd this year it was announced that Enums would be supported in
the next version of the Entity Framework and in June the &lt;a href="http://blogs.msdn.com/b/adonet/archive/2011/06/30/announcing-the-microsoft-entity-framework-june-2011-ctp.aspx" target="_blank"&gt;Entity
Framework June CTP&lt;/a&gt; was released with Enum support as well some other enhancements.
&lt;/p&gt;
&lt;p&gt;
In the past I dealt with Entity Framework not supporting Enum by having an int property
on my model that represented the Enum’s id.&amp;nbsp; My model also had a property of
the Enum type that was marked as ignored so that EF did not try create a database
column for the property.&amp;nbsp; The setter of the property would set the Enum id field
and the getter would convert the Enum id field to the Enum type and return it.&amp;nbsp;
If you are confused by that statement, like me, see the code below.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:85a9be36-c043-4902-90ce-31080c680069" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div class="le-pavsc-titleblock"&gt;Model.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Model&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;long&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ModelId&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;StringLength&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff4aff"&gt;50&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;int&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Year&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;decimal&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;BasePrice&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;int&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color:#f07800"&gt;) &lt;/span&gt;&lt;span style="color:#dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;int&lt;/span&gt;&lt;span style="color:#f07800"&gt;) &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;value&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#5ebbd7"&gt;#region&lt;/span&gt;&lt;span style="color:#f07800"&gt; &amp;lt;&amp;lt; Navigation
Properties &amp;gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;long&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ManufacturerId&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;virtual&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;virtual&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Engine&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6845923f-a0b6-43da-b3ee-308923a6d89d" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div class="le-pavsc-titleblock"&gt;DataContext.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DataContext&lt;/span&gt;&lt;span style="color:#f07800"&gt; : &lt;/span&gt;&lt;span style="color:#02e836"&gt;DbContext&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DataContext&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
: &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;base&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;name=EFCodeFirst&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IDbSet&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Manufacturers&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IDbSet&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Model&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Models&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IDbSet&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Engine&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Engines&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;protected&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;override&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnModelCreating&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#02e836"&gt;DbModelBuilder&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Conventions&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Remove&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;PluralizingTableNameConvention&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Entity&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Model&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;()&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Ignore&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Entity&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Model&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;()&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;HasMany&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;WithMany&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;AvailableOn&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Map&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;MapLeftKey&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;ModelId&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;MapRightKey&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;EngineId&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ToTable&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;ModelEngine&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;));&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;base&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnModelCreating&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
This gets the job done and really isn’t that messy, but with the new Enum support
in the June CTP I can make things cleaner.&amp;nbsp; To make use of the new Enum support
all I have to do is declare a property of EngineLocationType in my model and EF will
make all the connections for me.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c53f7499-bb6e-4cec-bcaf-9886b380d47f" class="wlWriterEditableSmartContent"&gt;
&lt;div class="le-pavsc-container"&gt;
&lt;div class="le-pavsc-titleblock"&gt;Model.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Model&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;long&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ModelId&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;StringLength&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff4aff"&gt;50&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;int&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Year&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;decimal&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;BasePrice&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#region&lt;/span&gt;&lt;span style="color:#f07800"&gt; &amp;lt;&amp;lt; Relationships
&amp;gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;long&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ManufacturerId&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;virtual&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;virtual&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Engine&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&lt;span style="color:#5ebbd7"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li class="even"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
So that is the new EF Enum support.&amp;nbsp; The only issue I have with the implementation
is that ideally I would like to be able to have an EngineLocationType table in my
database that Entity Framework would create and populate based on my Enum definition
and assign a foreign key relationship to EngineLocation on my Model entity.&amp;nbsp;
That would make the entire process complete and architecturally sound IMHO.
&lt;/p&gt;
&lt;p&gt;
If you are looking for a code download this is part of the &lt;a href="http://dotnetdevdude.com/Blog/2011/10/31/EntityFramework41CodeFirstDemoPlusSomeOfTheNewFeaturesInVNext.aspx" target="_blank"&gt;Entity
Framework Code First Demo&lt;/a&gt; that I did in a previous blog post and the code is available
on &lt;a href="https://github.com/kburnell/EFCodeFirstDemo" target="_blank"&gt;GitHub&lt;/a&gt;. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=a842a512-d914-4da0-b622-4af3d9800ed2" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,a842a512-d914-4da0-b622-4af3d9800ed2.aspx</comments>
      <category>Code</category>
      <category>Code First</category>
      <category>EF</category>
      <category>Entity Framework</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=2bf5f90f-ef0a-487e-86f3-2cbc085623c1</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,2bf5f90f-ef0a-487e-86f3-2cbc085623c1.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,2bf5f90f-ef0a-487e-86f3-2cbc085623c1.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2bf5f90f-ef0a-487e-86f3-2cbc085623c1</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>Simplify Integration Testing With Entity Framework Code First</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,2bf5f90f-ef0a-487e-86f3-2cbc085623c1.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/12/12/SimplifyIntegrationTestingWithEntityFrameworkCodeFirst.aspx</link>
      <pubDate>Mon, 12 Dec 2011 15:25:24 GMT</pubDate>
      <description>&lt;p&gt;
Integration Testing is a necessary evil that often gets overlooked or is implemented,
ran once, and then not maintained. The reasoning behind this is that by definition
Integration Testing relies on external resources that are often outside of our control
and some times completely hands off. Also these external resources are in constant
use by a large number of people making whatever resource the external systems are
serving very volatile. In this post I am going to focus on the most common external
resource; the Database.
&lt;/p&gt;
&lt;p&gt;
Integration Testing when you have a Database as an external resource can be a nightmare.
First off you need to have access to the database. Once that is accomplished you need
to have elevated access to the database in order to run scripts. Scripts you say?
Yes scripts! Scripts that can put the database in an expected state every time you
run the Integration Tests. Oh, yeah then you have to make sure that the script is
run.
&lt;/p&gt;
&lt;p&gt;
Luckily if you are using Entity Framework Code First you more than likely already
have elevated access to the Database and are probably running a local instance of
SQL Server on your dev box that you are in control of. But in the typical scenario
you would still have to write the SQL Scripts, which if you are like me you don’t
enjoy, and then you have to make sure they are run and that they don’t impact the
data that you use to manually UI test your application…we all have that one piece
of data that rely on…don’t deny it!
&lt;/p&gt;
&lt;p&gt;
So how does EF Code First help me with this overwhelming problem?
&lt;/p&gt;
&lt;p&gt;
All example code is from my &lt;a href="https://github.com/kburnell/EFCodeFirstDemo" target="_blank"&gt;EFCodeFirstDemo&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;u&gt;&lt;strong&gt;Seeded Data:&lt;/strong&gt;&lt;/u&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
In Entity Framework Code First you are given the ability to hook into the database
generation process and seed the database with relevant data for testing. The best
part about this is that you do it all using your POCO domain entities and LINQ to
Entities…NO SQL SCRIPTS! WOOT!
&lt;/p&gt;
&lt;p&gt;
The first step in the process is to create a custom data context initializer that
implements an implementation &lt;a href="http://msdn.microsoft.com/en-us/library/gg696323(VS.103).aspx" target="_blank"&gt;IDatabaseInitializer&lt;/a&gt;.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/gg679604(VS.103).aspx" target="_blank"&gt;DropCreateDatabaseIfModelChanges&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/gg679506(VS.103).aspx" target="_blank"&gt;DropCreateDatabaseAlways&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0f09e69a-a2d8-4351-b5d2-3fc97ab81923" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #000000; padding-top: 0px"&gt;
&lt;li&gt;
&lt;span style="color: #5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;TestDataContextInitializer&lt;/span&gt;&lt;span style="color: #f07800"&gt; : &lt;/span&gt;&lt;span style="color: #02e836"&gt;DropCreateDatabaseIfModelChanges&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;DataContext&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {}&lt;/span&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The next step is to override the Seed method that hooks into the generation of the
database.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:dcb0380f-362d-4ba0-9900-5afb009b096d" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #000000; padding-top: 0px"&gt;
&lt;li&gt;
&lt;span style="color: #5ebbd7"&gt;protected&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;override&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Seed&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #02e836"&gt;DataContext&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;)
{&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;base&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Seed&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;}&lt;/span&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br&gt;
&lt;/blockquote&gt; 
&lt;p&gt;
&lt;strong&gt;&lt;u&gt;&lt;/u&gt;&lt;/strong&gt;
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
Finally you can use this Seed method to build up your test data and populate the database
either every time your model changes (&lt;a href="http://msdn.microsoft.com/en-us/library/gg679604(VS.103).aspx" target="_blank"&gt;DropCreateDatabaseIfModelChanges&lt;/a&gt;)
or if you choose every time you spin up a new session that accesses the database (&lt;a href="http://msdn.microsoft.com/en-us/library/gg679506(VS.103).aspx" target="_blank"&gt;DropCreateDatabaseAlways&lt;/a&gt;),
I don’t recommend the latter.
&lt;/p&gt;
&lt;p&gt;
In the code below I am building up object graphs using my standard POCO entities and
LINQ to Entities.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fee12ce5-ee3c-45f9-aeba-f9536cf4d9f5" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #000000; padding-top: 0px"&gt;
&lt;li&gt;
&lt;span style="color: #5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;TestDataContextInitializer&lt;/span&gt;&lt;span style="color: #f07800"&gt; : &lt;/span&gt;&lt;span style="color: #02e836"&gt;DropCreateDatabaseIfModelChanges&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;DataContext&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt; 
&lt;li&gt;
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartin&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinDB9&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinV12&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinV12Vantage&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrari&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrari458Italia&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariScaglietti&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariV12&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariV8&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghini&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniAventador&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniGallardo&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniV10&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniV12&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porsche&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porsche911GT2R2&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porscheStraight6&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;protected&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;override&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Seed&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #02e836"&gt;DataContext&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;)
{&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;SeedManufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;SeedEngine&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;SeedModel&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;base&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Seed&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; }&lt;/span&gt; 
&lt;li&gt;
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;SeedManufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #02e836"&gt;DataContext&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;)
{&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrari&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Ferrari"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Country&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Italy"}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghini&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Lamborghini"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Country&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Italy"}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartin&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Aston
Martin"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Country&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"United
Kingdom"}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porsche&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Porsche"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Country&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Germany"}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrari&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Location&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Parse&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #ff3264"&gt;"POINT(44.53244
10.86412)"&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghini&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Location&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Parse&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #ff3264"&gt;"POINT
(44.65934 11.12693)"&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartin&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Location&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Parse&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #ff3264"&gt;"POINT
(52.18708 -1.48351)"&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porsche&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Location&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Parse&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #ff3264"&gt;"POINT
(48.83498 9.15231)"&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrari&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghini&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartin&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porsche}&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;ForEach&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;x&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Manufacturers&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Add&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;x&lt;/span&gt;&lt;span style="color: #f07800"&gt;));&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; }&lt;/span&gt; 
&lt;li&gt;
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;SeedEngine&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #02e836"&gt;DataContext&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;)
{&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinV12&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"6.0L
V12"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BreakHorsepower&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;510&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;NumberOfCylinders&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;12&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Liters&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;6.0m}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariV8&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"5.4L
V8"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BreakHorsepower&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;570&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;NumberOfCylinders&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;8&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Liters&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;5.4m}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariV12&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"5.7L
V12"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BreakHorsepower&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;532&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;NumberOfCylinders&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;12&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Liters&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;5.7m}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniV10&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"5.2L
V10"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BreakHorsepower&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;562&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;NumberOfCylinders&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;10&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Liters&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;5.2m}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniV12&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"6.5L
V12"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BreakHorsepower&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;700&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;NumberOfCylinders&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;12&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Liters&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;6.5m}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniV12&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"6.5L
V12"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BreakHorsepower&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;700&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;NumberOfCylinders&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;12&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Liters&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;6.5m}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porscheStraight6&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"3.6L
Straight 6"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BreakHorsepower&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;620&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;NumberOfCylinders&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;6&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Liters&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;3.6m}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinV12&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariV8&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariV12&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniV10&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniV12&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porscheStraight6}&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;ForEach&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;x&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Engines&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Add&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;x&lt;/span&gt;&lt;span style="color: #f07800"&gt;));&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; }&lt;/span&gt; 
&lt;li&gt;
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;SeedModel&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #02e836"&gt;DataContext&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;)
{&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrari458Italia&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"458
Italia"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BasePrice&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;220000&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Year&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;2012&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrari&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariV8&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariV12}&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Mid}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariScaglietti&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Scaglietti"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BasePrice&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;313000&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Year&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;2012&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrari&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariV12}&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Front}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniGallardo&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Gallardo
LP 570-4 Superleggera"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BasePrice&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;237600&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Year&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;2012&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghini&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniV10}&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Mid}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniAventador&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Aventador
LP 700-4"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BasePrice&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;387000&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Year&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;2012&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghini&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniV12}&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Mid}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinDB9&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"DB9"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BasePrice&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;185000&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Year&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;2012&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartin&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinV12}&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Front}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinV12Vantage&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"V12
Vantage"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BasePrice&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;180000&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Year&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;2012&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartin&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinV12}&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Mid}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porsche911GT2R2&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Name&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"911
GT2 R2"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;BasePrice&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;245000&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Year&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ff4aff"&gt;2012&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;Manufacturer&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porsche&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Engine&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porscheStraight6}&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;EngineLocation&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;EngineLocationType&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Rear}&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;List&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&lt;&lt;/span&gt;&lt;span style="color: #02e836"&gt;Model&lt;/span&gt;&lt;span style="color: #ffff00"&gt;&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrari458Italia&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_ferrariScaglietti&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniAventador&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_lamborghiniGallardo&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinDB9&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_astonMartinV12Vantage&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;_porsche911GT2R2}&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;ForEach&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;x&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&gt;&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Models&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Add&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;x&lt;/span&gt;&lt;span style="color: #f07800"&gt;));&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; }&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;}&lt;/span&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The result of this process is that every time my database is dropped and recreated
it is also seeded with test data. 
&lt;/p&gt;
&lt;p&gt;
I know what your saying…”But I don’t use the same data for manually walking through
my UI that I would use for Integration Testing!” Luckily I can easily specify a different
Connection String and Database Initializer to use when running my Integration Tests. 
&lt;/p&gt;
&lt;p&gt;
The first thing you have to do is modify the connection string in the AppConfig of
your Integration Test project to use a different initial catalog. As you can see all
I did was suffix mine with “_TEST”…clever I know! This is going to setup a new database
for you that will only be used for testing.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:8a90a062-6dbf-42d6-86f2-c32ed64e44b7" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #000000; padding-top: 0px"&gt;
&lt;li&gt;
&lt;span style="color: #ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="color: #dddddd"&gt;connectionStrings&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;&gt;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #ffd62f"&gt;&lt;&lt;/span&gt; &lt;span style="color: #dddddd"&gt;add&lt;/span&gt;&lt;span style="color: #ffd62f"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;name&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;=&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #58ff2f"&gt;EFCodeFirst&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #ffd62f"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;connectionString&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;=&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #58ff2f"&gt;Data
Source=(local);Initial Catalog=EFCodeFirst_TEST;Integrated Security=True;MultipleActiveResultSets=True;&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #ffd62f"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;providerName&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;=&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #58ff2f"&gt;System.Data.SqlClient&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;/&gt;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #ffd62f"&gt;&lt;/span&gt; &lt;span style="color: #dddddd"&gt;connectionStrings&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;&gt;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #ffd62f"&gt; &lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #ffd62f"&gt; &lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
Next you need to tell EF what Database Initializer to use. This can be accomplished
two ways. The first way is to explicitly set it in code. In the example below I am
doing this in the ClassInitialize of my Integration Test class.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1933989c-3681-4fd3-8b92-ec1c6fa0e5fe" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #000000; padding-top: 0px"&gt;
&lt;li&gt;
&lt;span style="color: #f07800"&gt;[&lt;/span&gt;&lt;span style="color: #02e836"&gt;ClassInitialize&lt;/span&gt;&lt;span style="color: #f07800"&gt;]&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;static&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;ClassInitialize&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #02e836"&gt;TestContext&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;context&lt;/span&gt;&lt;span style="color: #f07800"&gt;)
{&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;Database&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;SetInitializer&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;TestDataContextInitializer&lt;/span&gt;&lt;span style="color: #f07800"&gt;());&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;}&lt;/span&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
The second way is to set it configure it in the App/Web Config.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d163caa3-5b0f-4067-a514-a2c17c30effd" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #000000; padding-top: 0px"&gt;
&lt;li&gt;
&lt;span style="color: #ffd62f"&gt;&lt;&lt;/span&gt;&lt;span style="color: #dddddd"&gt;appSettings&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;&gt;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #ffd62f"&gt;&lt;&lt;/span&gt; &lt;span style="color: #dddddd"&gt;add&lt;/span&gt;&lt;span style="color: #ffd62f"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;key&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;=&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #58ff2f"&gt;DatabaseInitializerForType
EFCodeFirst.DataContext.DataContext, EFCodeFirst&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #ffd62f"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;value&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;=&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #58ff2f"&gt;EFCodeFirst.DataContext.TestDataContextInitializer,
EFCodeFirst&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;"&lt;/span&gt;&lt;span style="color: #ffd62f"&gt; /&gt;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #ffd62f"&gt;&lt;/span&gt; &lt;span style="color: #dddddd"&gt;appSettings&lt;/span&gt;&lt;span style="color: #ffd62f"&gt;&gt;&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #ffd62f"&gt; &lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/blockquote&gt; &lt;blockquote&gt;That’s it! Now you have a separate Database instance just
for Integration Testing that will always contain the clean fresh data that is required
to exercise your Integration Test suite. Better yet, every developer that runs your
Integration Tests will also have this data and everything will just work.&lt;/blockquote&gt;&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=2bf5f90f-ef0a-487e-86f3-2cbc085623c1" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,2bf5f90f-ef0a-487e-86f3-2cbc085623c1.aspx</comments>
      <category>Code</category>
      <category>Code First</category>
      <category>EF</category>
      <category>Entity Framework</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=13539030-3de2-4021-a125-0c446f6b4283</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,13539030-3de2-4021-a125-0c446f6b4283.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,13539030-3de2-4021-a125-0c446f6b4283.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=13539030-3de2-4021-a125-0c446f6b4283</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>EF Code First Configuration–When to Use Fluent API and When To Use Attributes</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,13539030-3de2-4021-a125-0c446f6b4283.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/12/05/EFCodeFirstConfigurationWhenToUseFluentAPIAndWhenToUseAttributes.aspx</link>
      <pubDate>Mon, 05 Dec 2011 14:53:57 GMT</pubDate>
      <description>&lt;p&gt;
Configuration of Entity Framework Code First is a necessary evil and you have to admit
is a very well designed user friendly process.&amp;nbsp; But, in typical Microsoft fashion,
the EF developers have given us more than one way to perform this configuration.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Fluent API 
&lt;ol type="a"&gt;
&lt;li&gt;
Fluent expression based configuration 
&lt;li&gt;
Performed during the OnModelCreating process of the DbContext. 
&lt;li&gt;
Allows for complex configurations that are not possible via Attribute based configuration&lt;br&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6987d79d-f67f-42da-9af1-8c806f8e9d2b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Fluent
Configuration
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;protected&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;override&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnModelCreating&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#02e836"&gt;DbModelBuilder&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Conventions&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Remove&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;PluralizingTableNameConvention&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Entity&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Model&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;()&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;HasMany&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;AvailableEngines&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;WithMany&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;AvailableOn&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Map&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;MapLeftKey&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;ModelId&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;MapRightKey&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;EngineId&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ToTable&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;ModelEngine&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;));&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Entity&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Model&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;()&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Ignore&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;SomeDerivedProperty&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;base&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnModelCreating&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;modelBuilder&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;br&gt;
&lt;li&gt;
Attributes 
&lt;ol type="a"&gt;
&lt;li&gt;
Attribute based configuration 
&lt;li&gt;
Performed directly on the Domain Model Class/Property being configured 
&lt;li&gt;
Allows the non-EF specific attributes to be used in other pieces of your application 
&lt;li&gt;
Allows validation of your Model at any time&lt;br&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9274a0b0-275e-413b-b80d-e1bb7917e106" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Attribute
Configuration
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Manufacturer&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;long&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ManufacturerId&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; [&lt;/span&gt;&lt;span style="color:#02e836"&gt;StringLength&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff4aff"&gt;40&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; [&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; [&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; [&lt;/span&gt;&lt;span style="color:#02e836"&gt;StringLength&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff4aff"&gt;40&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Country&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; [&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DbGeography&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Location&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt; #region&lt;/span&gt;&lt;span style="color:#f07800"&gt; &amp;lt;&amp;lt; Relationships
&amp;gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;virtual&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Model&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Models&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt; #endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
So…When do you use which!?
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Use Fluent Configuration When:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Configuration is being done solely to make the database behave correctly. 
&lt;li&gt;
Configuration has no effect on the design and/or behavior of your Domain Model. 
&lt;li&gt;
Examples: 
&lt;ul&gt;
&lt;li&gt;
Specifying the database table the Domain Model is to be mapped to 
&lt;li&gt;
Specifying the database table column the Domain Model Field is to be mapped to 
&lt;li&gt;
Ignoring a Domain Model Field 
&lt;li&gt;
Configuring the keys and table names for relationships not able to be picked up by
EF&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;strong&gt;Use Attribute Configuration When:&lt;/strong&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Configuration solely applies to your Domain Model. 
&lt;li&gt;
Configuration has no effect on the design and/or behavior of your Database. 
&lt;li&gt;
Examples: 
&lt;ul&gt;
&lt;li&gt;
Making a field Required 
&lt;li&gt;
Validating a field (String length, Range, etc.)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Also…Don’t forget that for the most part these Attributes are not EF specific and
can be used in the UI with MVC.&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=13539030-3de2-4021-a125-0c446f6b4283" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,13539030-3de2-4021-a125-0c446f6b4283.aspx</comments>
      <category>Code</category>
      <category>Code First</category>
      <category>Entity Framework</category>
      <category>Ranting</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=74adf914-45af-4a3a-a622-bfede90d1e73</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,74adf914-45af-4a3a-a622-bfede90d1e73.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,74adf914-45af-4a3a-a622-bfede90d1e73.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=74adf914-45af-4a3a-a622-bfede90d1e73</wfw:commentRss>
      <title>jQuery Accordion Item with no Children as Link</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,74adf914-45af-4a3a-a622-bfede90d1e73.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/11/28/jQueryAccordionItemWithNoChildrenAsLink.aspx</link>
      <pubDate>Mon, 28 Nov 2011 15:52:57 GMT</pubDate>
      <description>&lt;p&gt;
The &lt;a href="http://docs.jquery.com/UI/Accordion" target="_blank"&gt;jQuery Accordion&lt;/a&gt; control
is great for creating rich interactive HTML menus.&amp;nbsp; I used it in a recent project
where I wanted “Home” to be the top menu option.&amp;nbsp; I Googled around and wasn’t
able to find a way to have a menu item with no children link to some URL.&amp;nbsp; So
I played around for a bit and came up this solution.&amp;nbsp; 
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:93290ae8-0c83-4a87-be6b-d6ec9bb68db0" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#dddddd"&gt;$&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;function&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;$&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;quot;#navigationMenu&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;).&lt;/span&gt;&lt;span style="color:#dddddd"&gt;accordion&lt;/span&gt;&lt;span style="color:#f07800"&gt;({ &lt;/span&gt;&lt;span style="color:#dddddd"&gt;autoHeight&lt;/span&gt;&lt;span style="color:#ffff00"&gt;:&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;false&lt;/span&gt;&lt;span style="color:#f07800"&gt; });&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;$&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;#39;#homeNavMenu&amp;#39;&lt;/span&gt;&lt;span style="color:#f07800"&gt;).&lt;/span&gt;&lt;span style="color:#dddddd"&gt;find&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;#39;a&amp;#39;&lt;/span&gt;&lt;span style="color:#f07800"&gt;).&lt;/span&gt;&lt;span style="color:#dddddd"&gt;click&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;function&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{ &lt;/span&gt;&lt;span style="color:#dddddd"&gt;window&lt;/span&gt;&lt;span style="color:#f07800"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;location&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;#39;/&amp;#39;&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
});&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;});&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=74adf914-45af-4a3a-a622-bfede90d1e73" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,74adf914-45af-4a3a-a622-bfede90d1e73.aspx</comments>
      <category>Code</category>
      <category>jQuery</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=5c9a7035-5652-44fb-99f7-ebbc09cd9d2b</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,5c9a7035-5652-44fb-99f7-ebbc09cd9d2b.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,5c9a7035-5652-44fb-99f7-ebbc09cd9d2b.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5c9a7035-5652-44fb-99f7-ebbc09cd9d2b</wfw:commentRss>
      <title>ASP.NET MVC–Redirect to Custom Page when User is not Authorized</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,5c9a7035-5652-44fb-99f7-ebbc09cd9d2b.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/11/21/ASPNETMVCRedirectToCustomPageWhenUserIsNotAuthorized.aspx</link>
      <pubDate>Mon, 21 Nov 2011 15:46:18 GMT</pubDate>
      <description>&lt;p&gt;
If you ever need to redirect to a custom page in ASP.NET MVC when a user is either
not authenticated or not authorized here is how you do it.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Create a custom attribute that inherits from &lt;strong&gt;&lt;em&gt;AuthorizeAttribute&lt;/em&gt;&lt;/strong&gt;. 
&lt;li&gt;
Override the &lt;strong&gt;&lt;em&gt;OnAuthorization&lt;/em&gt;&lt;/strong&gt; method. 
&lt;ul&gt;
&lt;li&gt;
call the base OnAuthorization 
&lt;li&gt;
Handle user not being authenticated 
&lt;li&gt;
Handle user not being authorized&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;
Use the newly created attribute in your controller in place of the ASP.NET Authorize
attribute&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0c708594-da3a-466c-bc84-a6ebcaa4368f" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;The
Custom Attribute
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;CustomAuthorizeAttribute&lt;/span&gt;&lt;span style="color:#f07800"&gt; : &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthorizeAttribute&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;override&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnAuthorization&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthorizationContext&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;filterContext&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;base&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnAuthorization&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;filterContext&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;if&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#ffff00"&gt;!&lt;/span&gt;&lt;span style="color:#dddddd"&gt;filterContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;HttpContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;User&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Identity&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;IsAuthenticated&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;filterContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Result&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;RedirectResult&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;~/Account/Logon&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;if&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#dddddd"&gt;filterContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Result&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;is&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;HttpUnauthorizedResult&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;filterContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Result&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;RedirectResult&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;~/Account/AccessDenied&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f4c27867-9edd-4021-a5a7-41eab64307f6" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Example
Controller Usage
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;CustomAuthorize&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Roles&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Admin,Manager&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;))]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ActionResult&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Index&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;View&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=5c9a7035-5652-44fb-99f7-ebbc09cd9d2b" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,5c9a7035-5652-44fb-99f7-ebbc09cd9d2b.aspx</comments>
      <category>Code</category>
      <category>MVC</category>
      <category>MVC3</category>
      <category>Security</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=7f880b64-7065-4f82-bbf1-c15763d4b46e</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,7f880b64-7065-4f82-bbf1-c15763d4b46e.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,7f880b64-7065-4f82-bbf1-c15763d4b46e.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7f880b64-7065-4f82-bbf1-c15763d4b46e</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>ASP.NET MVC 3 --- DropDownListFor Enum</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,7f880b64-7065-4f82-bbf1-c15763d4b46e.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/11/14/ASPNETMVC3DropDownListForEnum.aspx</link>
      <pubDate>Mon, 14 Nov 2011 14:46:32 GMT</pubDate>
      <description>&lt;p&gt;
ASP.NET MVC has an HTML Helper &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.html.selectextensions.dropdownlistfor.aspx" target="_blank"&gt;DropDownListFor&lt;/a&gt; that
takes an IEnumerable and creates a drop down list for it.&amp;nbsp; Often you want to
create a drop down list for an Enum.&amp;nbsp; Of course you can do this without using
an HTML Helper and use standard HTML controls but you don’t have the standard clean
view code that HTML Helpers give you.&amp;nbsp; Extending and creating your own HTML Helpers
is rather easy, as demonstrated in my last post. With that in mind I created an extension
to DropDownListFor that will create a drop down list for an Enum type.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6ed7ec63-91f0-4d47-92d2-0d170ace167b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Enum
Html Helper
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;System&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Collections&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Generic&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;System&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Linq&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;System&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Linq&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Expressions&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListForEnumDemo&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Extensions&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;System&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Web&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Mvc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Html&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;static&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;EnumHtmlHelper&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;static&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;MvcHtmlString&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListFor&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;TModel&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;this&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;HtmlHelper&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TModel&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#02e836"&gt;Expression&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Func&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TModel,
TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;expression&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListFor&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;expression&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;null&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;null&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;static&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;MvcHtmlString&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListFor&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;TModel&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;this&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;HtmlHelper&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TModel&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#02e836"&gt;Expression&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Func&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TModel,
TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;expression&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;optionLabel&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListFor&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;expression&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;optionLabel&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;null&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;static&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;MvcHtmlString&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListFor&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;TModel&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;this&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;HtmlHelper&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TModel&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#02e836"&gt;Expression&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Func&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TModel,
TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;expression&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;object&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlAttributes&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListFor&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;expression&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;null&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlAttributes&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;static&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;MvcHtmlString&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListFor&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;TModel&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;this&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;HtmlHelper&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TModel&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#02e836"&gt;Expression&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Func&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TModel,
TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;expression&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;optionLabel&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;object&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlAttributes&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ModelMetadata&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;metadata&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ModelMetadata&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;FromLambdaExpression&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;expression&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ViewData&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Type&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;enumType&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Nullable&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetUnderlyingType&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;typeof&lt;/span&gt;&lt;span style="color:#f07800"&gt; (TEnum)) &lt;/span&gt;&lt;span style="color:#ffff00"&gt;??&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;typeof&lt;/span&gt;&lt;span style="color:#f07800"&gt; (TEnum);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IEnumerable&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;enumValues&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Enum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetValues&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;enumType&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Cast&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;TEnum&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IEnumerable&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;SelectListItem&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;items&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;enumValues&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Select&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;e&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;SelectListItem&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Text&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;e&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ToString&lt;/span&gt;&lt;span style="color:#f07800"&gt;()&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;FromCamelToProperCase&lt;/span&gt;&lt;span style="color:#f07800"&gt;(), &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Value&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;e&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ToString&lt;/span&gt;&lt;span style="color:#f07800"&gt;(), &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Selected&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;e&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Equals&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;metadata&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Model&lt;/span&gt;&lt;span style="color:#f07800"&gt;)});&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;if&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#dddddd"&gt;optionLabel&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;!=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;null&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt;[]
{&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;SelectListItem&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Text&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;optionLabel}}&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Concat&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;items&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListFor&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;expression&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;items&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;optionLabel&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;htmlAttributes&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ddab5787-1d1c-4ef9-804e-407285ff56d9" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Enum
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListForEnumDemo&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Enumerations&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;enum&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Cars&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;FerrariItalia&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff4aff"&gt;0&lt;/span&gt;&lt;span style="color:#f07800"&gt;,&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;LamborghiniGallardoLP560&lt;/span&gt;&lt;span style="color:#f07800"&gt;,&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;LamborghiniAventador&lt;/span&gt;&lt;span style="color:#f07800"&gt;,&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;AstonMartinVantage&lt;/span&gt;&lt;span style="color:#f07800"&gt;,&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Porsche911GT2&lt;/span&gt;&lt;span style="color:#f07800"&gt;,&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&gt;
&lt;p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:407eb06e-9834-47b2-98d3-2f1058e09cdf" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Model
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListForEnumDemo&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Models&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;CarsModel&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; [&lt;/span&gt;&lt;span style="color:#02e836"&gt;Display&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Name&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Select
A Car:&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; [&lt;/span&gt;&lt;span style="color:#02e836"&gt;Required&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ErrorMessage&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;*
Required&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Cars&lt;/span&gt;&lt;span style="color:#ffff00"&gt;?&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;SelectedCar&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:e32cbafb-834e-4da0-b7b6-e8b1c5db1975" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;View
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="background:#ffff64"&gt;@{&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ViewBag&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Title&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Home
Page&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#ffff64"&gt;@&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListForEnumDemo&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Models&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#ffff64"&gt;@model &lt;/span&gt;&lt;span style="color:#02e836"&gt;CarsModel&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffd62f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;h2&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background:#ffff64"&gt;@&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ViewBag&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Message&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;h2&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#ffff64"&gt;@&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Html&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;BeginForm&lt;/span&gt;&lt;span style="color:#f07800"&gt;())
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;div&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;fieldset&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;div&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#58ff2f"&gt;&amp;quot;editor-label&amp;quot;&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#ffff64"&gt;@&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Html&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;LabelFor&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;m&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;m&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;SelectedCar&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;div&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;div&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#58ff2f"&gt;&amp;quot;editor-field&amp;quot;&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#ffff64"&gt;@&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Html&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;DropDownListFor&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;m&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;m&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;SelectedCar&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;--
Select --&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="background:#ffff64"&gt;@&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Html&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ValidationMessageFor&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;m&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;m&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;SelectedCar&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;div&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;fieldset&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;input&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;type&lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#58ff2f"&gt;&amp;quot;submit&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;value&lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#58ff2f"&gt;&amp;quot;Click
Me&amp;quot;&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#ebebeb"&gt;div&lt;/span&gt;&lt;span style="color:#ffd62f"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ASP.NET-MVC-3-----DropDownListFor-Enum_B9DD/image_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/ASP.NET-MVC-3-----DropDownListFor-Enum_B9DD/image_thumb.png" width="970" height="370"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Note:&amp;nbsp; Because enumeration values have to adhere to the same naming conventions
as variables I had to work some magic to get the display values formatted correctly.&amp;nbsp;
OK, it’s really not magic…just a little RegEx Voo-Doo.
&lt;/p&gt;
&lt;p&gt;
The code is available on &lt;a href="https://github.com/kburnell/DropDownListForEnum" target="_blank"&gt;GitHub&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=7f880b64-7065-4f82-bbf1-c15763d4b46e" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,7f880b64-7065-4f82-bbf1-c15763d4b46e.aspx</comments>
      <category>Code</category>
      <category>HTML Helpers</category>
      <category>MVC</category>
      <category>MVC3</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=d1bc810e-cee1-4a38-967e-af7eb553831b</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,d1bc810e-cee1-4a38-967e-af7eb553831b.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,d1bc810e-cee1-4a38-967e-af7eb553831b.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=d1bc810e-cee1-4a38-967e-af7eb553831b</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>ASP.NET MVC–ActionLink Button</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,d1bc810e-cee1-4a38-967e-af7eb553831b.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/11/07/ASPNETMVCActionLinkButton.aspx</link>
      <pubDate>Mon, 07 Nov 2011 14:53:15 GMT</pubDate>
      <description>&lt;p&gt;
ASP.NET MVC provides a lot of &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.htmlhelper.aspx" target="_blank"&gt;HTML
Helpers&lt;/a&gt; that allow you to more easily with less code create your views.&amp;nbsp;
Typically navigation in MVC is done using the &lt;a href="http://msdn.microsoft.com/en-us/library/system.web.mvc.html.linkextensions.actionlink.aspx" target="_blank"&gt;ActionLink&lt;/a&gt; HTML
Helper that allows you easily generate an html anchor tag that will redirect to a
specified controller and action.&amp;nbsp; I found cases where I wanted my navigation
to be done via a button rather than a link so I created my own HTML Helper to make
this easier.
&lt;/p&gt;
&lt;p&gt;
Code:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ad6c4469-dcdf-4bdb-ac3f-41ab8ecd0996" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2.5em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #000000; padding-top: 0px"&gt;
&lt;li&gt;
&lt;span style="color: #5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;System&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Web&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Routing&lt;/span&gt;&lt;span style="color: #f07800"&gt;;&lt;/span&gt; 
&lt;li&gt;
&amp;nbsp; 
&lt;li&gt;
&lt;span style="color: #5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;System&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Web&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Mvc&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Html&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt; 
&lt;li&gt;
&amp;nbsp; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;static&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;ActionLinkButtonHelper&lt;/span&gt;&lt;span style="color: #f07800"&gt; {&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;static&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;MvcHtmlString&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;ActionLinkButton&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;this&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;HtmlHelper&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;buttonText&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;actionName&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;controllerName&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #02e836"&gt;RouteValueDictionary&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;routeValues&lt;/span&gt;&lt;span style="color: #f07800"&gt;)
{&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;href&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;UrlHelper&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;GenerateUrl&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #ff3264"&gt;"default"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;actionName&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;controllerName&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;routeValues&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #02e836"&gt;RouteTable&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Routes&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #dddddd"&gt;htmlHelper&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;ViewContext&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;RequestContext&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;false&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;buttonHtml&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Format&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #ff3264"&gt;"&amp;lt;input
type=\"button\" title=\"{&lt;/span&gt;&lt;span style="color: #3cb371"&gt;0}\&lt;/span&gt;&lt;span style="color: #ff3264"&gt;"
value=\"{&lt;/span&gt;&lt;span style="color: #3cb371"&gt;0}\&lt;/span&gt;&lt;span style="color: #ff3264"&gt;"
onclick=\"location.href='{&lt;/span&gt;&lt;span style="color: #3cb371"&gt;1}&lt;/span&gt;&lt;span style="color: #ff3264"&gt;'\"
class=\"button\" /&amp;gt;"&lt;/span&gt;&lt;span style="color: #f07800"&gt;,&lt;/span&gt;&lt;span style="color: #dddddd"&gt;buttonText&lt;/span&gt;&lt;span style="color: #f07800"&gt;,&lt;/span&gt;&lt;span style="color: #dddddd"&gt;href&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;MvcHtmlString&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #dddddd"&gt;buttonHtml&lt;/span&gt;&lt;span style="color: #f07800"&gt;);&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt; 
&lt;li&gt;
&lt;span style="color: #f07800"&gt;}&lt;/span&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Example Usage:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2bc7ab8b-0ad1-4e33-9efd-24c687e93520" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom: #000080 1px solid; border-left: #000080 1px solid; font-family: 'Courier New', courier, monospace; color: #000; font-size: 10pt; border-top: #000080 1px solid; border-right: #000080 1px solid"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="padding-bottom: 0px; margin: 0px 0px 0px 2em; padding-left: 5px; padding-right: 0px; white-space: nowrap; background: #000000; padding-top: 0px"&gt;
&lt;li&gt;
&lt;span style="background: #ffff64"&gt;@&lt;/span&gt;&lt;span style="color: #dddddd"&gt;Html&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;ActionLinkButton&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #ff3264"&gt;"Add"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"AddSiteFromDistrict"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #ff3264"&gt;"SiteMaintenance"&lt;/span&gt;&lt;span style="color: #f07800"&gt;, &lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #02e836"&gt;RouteValueDictionary&lt;/span&gt;&lt;span style="color: #f07800"&gt;(&lt;/span&gt;&lt;span style="color: #5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color: #f07800"&gt; { &lt;/span&gt;&lt;span style="color: #dddddd"&gt;districtID&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #ffff00"&gt;=&lt;/span&gt;&lt;span style="color: #f07800"&gt; &lt;/span&gt;&lt;span style="color: #dddddd"&gt;@Model&lt;/span&gt;&lt;span style="color: #ffff00"&gt;.&lt;/span&gt;&lt;span style="color: #dddddd"&gt;DistrictID&lt;/span&gt;&lt;span style="color: #f07800"&gt; }))&lt;/span&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=d1bc810e-cee1-4a38-967e-af7eb553831b" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,d1bc810e-cee1-4a38-967e-af7eb553831b.aspx</comments>
      <category>Code</category>
      <category>HTML Helpers</category>
      <category>MVC</category>
      <category>MVC3</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=f70511b3-3b14-4e81-87c8-5b93cb617804</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,f70511b3-3b14-4e81-87c8-5b93cb617804.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,f70511b3-3b14-4e81-87c8-5b93cb617804.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=f70511b3-3b14-4e81-87c8-5b93cb617804</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>Entity Framework 4.1 Code First Demo (plus some of the new features in vNext)</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,f70511b3-3b14-4e81-87c8-5b93cb617804.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/10/31/EntityFramework41CodeFirstDemoPlusSomeOfTheNewFeaturesInVNext.aspx</link>
      <pubDate>Mon, 31 Oct 2011 13:35:41 GMT</pubDate>
      <description>&lt;p&gt;
I recently put together an Entity Framework Code First demo that I presented to my
colleagues at Skyline Technologies. 
&lt;/p&gt;
&lt;p&gt;
The demo includes:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Generating DB from POCO’s 
&lt;li&gt;
Fluent and Attribute EF configuration examples 
&lt;li&gt;
Creating Relationships (1 –&amp;gt; Many, Many –&amp;gt; Many) 
&lt;li&gt;
Seeding Data 
&lt;li&gt;
Using a separate DB instance for integration testing 
&lt;li&gt;
How using Data Annotations saves you time in MVC 
&lt;li&gt;
New Features Coming In EF vNext 
&lt;ul&gt;
&lt;li&gt;
Enums 
&lt;li&gt;
Spatial Data Type&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
I put the code up on &lt;a href="https://github.com/kburnell/EFCodeFirstDemo" target="_blank"&gt;GitHub&lt;/a&gt; so
if you are looking for an EF Code First kick starter took a look!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=f70511b3-3b14-4e81-87c8-5b93cb617804" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,f70511b3-3b14-4e81-87c8-5b93cb617804.aspx</comments>
      <category>Code</category>
      <category>CodeFirst</category>
      <category>EF</category>
      <category>EntityFramework</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=a55113dc-c50b-42e9-9cbb-e25d48076972</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,a55113dc-c50b-42e9-9cbb-e25d48076972.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,a55113dc-c50b-42e9-9cbb-e25d48076972.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a55113dc-c50b-42e9-9cbb-e25d48076972</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>EzValidation: Custom MVC Validation For Making Your Life Easier</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,a55113dc-c50b-42e9-9cbb-e25d48076972.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/10/30/EzValidationCustomMVCValidationForMakingYourLifeEasier.aspx</link>
      <pubDate>Sun, 30 Oct 2011 00:09:00 GMT</pubDate>
      <description>&lt;p&gt;
My latest project was being done in ASP.NET MVC3 and I needed to do some date validation
that was beyond what was available out-of-the-box.&amp;nbsp; I Googled around the inter-webs
for awhile and couldn’t find anything that met my needs so I decided to create my
own set of extensions…and while I was at create my &lt;a href="http://nuget.org/List/Packages/EzValidation" target="_blank"&gt;NuGet&lt;/a&gt; package
and &lt;a href="http://ezvalidation.codeplex.com/" target="_blank"&gt;CodePlex&lt;/a&gt; project.
&lt;/p&gt;
&lt;p&gt;
For some reason the validation attributes available for the Date data type are non-existence
in MVC.&amp;nbsp; You can compare to another model field, but that only checks for equality.&amp;nbsp;
You can use regular expressions, which is not fun, and you can only compare against
static values, or you can create your own validation attributes…which is the route
I chose.
&lt;/p&gt;
&lt;p&gt;
I created custom validation attributes that I found that I needed in my projects and
packed some up to make available to the masses.
&lt;/p&gt;
&lt;p&gt;
EzValidation contains validation for:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Equal, NotEqual, Greater, Less, GreaterOrEqual, LessOrEqual 
&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;
Available for all &lt;a href="http://en.wikipedia.org/wiki/Primitive_data_type" target="_blank"&gt;Primitive
Data Types&lt;/a&gt; (including nullable) 
&lt;li&gt;
Compare to another field in the Model 
&lt;/li&gt;
&lt;ul&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2d0abfa7-eb5e-4e75-bf98-4ca79a956579" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Equal&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Email&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ConfirmEmail&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/ul&gt;
&lt;li&gt;
Compare to a specific value 
&lt;/li&gt;
&lt;ul&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c1583dd6-0443-4fef-8797-39d3bae0975e" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;NotEqual&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;|28|&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;int&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Age&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/ul&gt;
&lt;li&gt;
Compare to Current Date (Dates and Strings only) 
&lt;/li&gt;
&lt;ul&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7005ba2b-4123-4459-b710-93fe1b0f9838" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Greater&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;CompareToCurrentDate&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DateTime&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ADateInTheFuture&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/ul&gt;
&lt;li&gt;
Compare to Yesterday's Date (Dates and Strings only) 
&lt;/li&gt;
&lt;ul&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b838ac48-268c-499b-ab47-d7f36d9554ba" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Less&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;CompareToYesterday&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DateTime&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DateBeforeYesterday&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/ul&gt;
&lt;li&gt;
Compare to Tomorrow's Date (Dates and Strings only) 
&lt;/li&gt;
&lt;ul&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4e3dc97d-ab25-42c0-9334-a5030bcb07d9" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;GreaterOrEqual&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;CompareToTomorrow&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DateTime&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;DateAfterTomorrow&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
The source Code is available on &lt;a href="http://ezvalidation.codeplex.com/" target="_blank"&gt;CodePlex&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The package can be installed via NuGet.&amp;nbsp; “package-install EzValidation"
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=a55113dc-c50b-42e9-9cbb-e25d48076972" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,a55113dc-c50b-42e9-9cbb-e25d48076972.aspx</comments>
      <category>Code</category>
      <category>MVC</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=1209bc62-b74a-470e-8cea-303d329a5e89</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,1209bc62-b74a-470e-8cea-303d329a5e89.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,1209bc62-b74a-470e-8cea-303d329a5e89.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=1209bc62-b74a-470e-8cea-303d329a5e89</wfw:commentRss>
      <title>Unit Testing Code That Depends on ASP.NET</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,1209bc62-b74a-470e-8cea-303d329a5e89.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/05/23/UnitTestingCodeThatDependsOnASPNET.aspx</link>
      <pubDate>Mon, 23 May 2011 00:17:23 GMT</pubDate>
      <description>&lt;p&gt;
Last weekend I presented a session at the third annual &lt;a href="http://www.chicagocodecamp.com/" target="_blank"&gt;Chicago
Code Camp&lt;/a&gt; entitled: &lt;a href="http://www.chicagocodecamp.com/sessions/2" target="_blank"&gt;Test-driven
Development in .NET – Tips, Tools, and Techniques&lt;/a&gt;.&amp;nbsp; The session was standing
room only and carried into the commons area afterwards with some excellent questions
from attendees.&amp;nbsp; What is greater than that is that the questions didn’t stop
there, they kept coming via email.&amp;nbsp; One question in particular has stuck with
me because it was a hurdle I myself had to overcome early on in my TDD adventures.
&lt;/p&gt;
&lt;p&gt;
The question boiled down to how do you test code the depends on ASP.NET, specifically
Web Configuration and Application Settings?&amp;nbsp; So I thought I would put together
a blog post how this can be done, and how it should be done.
&lt;/p&gt;
&lt;p&gt;
To set the stage…I have a simple ASP.NET web application with one page and one class.&amp;nbsp;
The page load method calls the one method in the class that returns an app setting
stored in the web config file.
&lt;/p&gt;
&lt;p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:26dcc8d6-5c28-455f-a819-bec66dcb538b" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Index.aspx.cs
&lt;/div&gt;
&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#6b98ff"&gt;namespace&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;WebApp&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#ffffff"&gt;{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;partial&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;Index&lt;/span&gt;&lt;span style="color:#ffffff"&gt; : &lt;/span&gt;&lt;span style="color:#fffec7"&gt;System&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;Web&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;UI&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#57ff52"&gt;Page&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#ffffff"&gt;{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;protected&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;void&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;Page_Load&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;object&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;sender&lt;/span&gt;&lt;span style="color:#ffffff"&gt;, &lt;/span&gt;&lt;span style="color:#57ff52"&gt;EventArgs&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;e&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#fffec7"&gt;lblValue&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;Text&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeStringValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&gt;
&lt;p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:99dac563-13f4-4dbb-921c-0a6121c1467e" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;SomeClassThatNeedsTesting.cs
&lt;/div&gt;
&lt;div style="background: #ddd; max-height: 300px; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#6b98ff"&gt;namespace&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;WebApp&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#ffffff"&gt;{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;static&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#ffffff"&gt;{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;static&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeStringValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;System&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;Web&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;Configuration&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#57ff52"&gt;WebConfigurationManager&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;AppSettings&lt;/span&gt;&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;MyAppSettingValue&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;];&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&gt;
&lt;p&gt;
Your first option to getting your tests to run and return the configuration and/or
app settings is to tell your tests to run under the ASP.NET host process and not the
VSTest host process and also tell what url to run the test under.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:96d6bf89-888f-42d6-9430-db64d565745d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;SomeClassThatNeedsTesting_Test
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;TestMethod&lt;/span&gt;&lt;span style="color:#ffffff"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;HostType&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;ASP.NET&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;UrlToTest&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;http://localhost:2356/Index.aspx&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;AspNetDevelopmentServerHost&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;$(SolutionDir)&amp;#92;&amp;#92;WebApp&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;void&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeStringValue_ShouldReturn_NonNull_NonEmpty_String&lt;/span&gt;&lt;span style="color:#ffffff"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;var&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;val&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;WebApp&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeStringValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#57ff52"&gt;Console&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;WriteLine&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#fffec7"&gt;val&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;ToString&lt;/span&gt;&lt;span style="color:#ffffff"&gt;());&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#57ff52"&gt;Assert&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;IsFalse&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;IsNullOrEmpty&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#fffec7"&gt;val&lt;/span&gt;&lt;span style="color:#ffffff"&gt;));&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
If you run this you will see that the test passes…eventually…after Casini is started
and the test runner twiddles its thumbs for a bit.&amp;nbsp; Speed is my first issue with
setting up your test to run in this fashion.&amp;nbsp; My second issue is that you aren’t
testing the ASP.NET configuration framework so why would you need to add all this
extra plumbing to make your code take that route?&amp;nbsp; There is a better option!
&lt;/p&gt;
&lt;p&gt;
Since we really don’t care how or where are value comes from we just need some sort
of value returned so we can test our method, we can easily add a thin layer of abstraction
and mock the pieces of code that depend on ASP.NET.
&lt;/p&gt;
&lt;p&gt;
Lets start by creating an interface for a simple class that reads application settings.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:3a83653e-0dd1-4f8f-9942-9f0b2a29fabe" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;IAppSettingsReader.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#6b98ff"&gt;namespace&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;WebApp&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;interface&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#2b91af"&gt;IAppSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetAppSettingValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;settingKey&lt;/span&gt;&lt;span style="color:#ffffff"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Now we can implement the interface and add the actual code to read the app settings
from the web config file.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1b93575e-88a8-4686-894f-bdc039a669a9" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;AppSettingsReader
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#6b98ff"&gt;namespace&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;WebApp&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;AppSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt; : &lt;/span&gt;&lt;span style="color:#2b91af"&gt;IAppSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetAppSettingValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;settingKey&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;if&lt;/span&gt;&lt;span style="color:#ffffff"&gt; (&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;IsNullOrEmpty&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#fffec7"&gt;settingKey&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)) &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;throw&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;NullReferenceException&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;settingKey
is required&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff"&gt; (&lt;/span&gt;&lt;span style="color:#57ff52"&gt;WebConfigurationManager&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;AppSettings&lt;/span&gt;&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#fffec7"&gt;settingKey&lt;/span&gt;&lt;span style="color:#ffffff"&gt;]);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Next we will modify our class that needs testing to use the new AppSettingsReader.&amp;nbsp;
Because our goal is to eventually be able to mock the settings reader we need to invert
the control of the dependency and provide a mechanism for injecting the dependency.&amp;nbsp;
The change is fairly straightforward.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6db70c00-6db0-4645-9132-90219e8dc8cf" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;SomeClassThatNeedsTesting
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#6b98ff"&gt;namespace&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;WebApp&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;private&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;readonly&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#2b91af"&gt;IAppSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;_settingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;SomeClassThatNeedsTesting&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#2b91af"&gt;IAppSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;settingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#fffec7"&gt;_settingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;settingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeStringValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;return&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;_settingsReader&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetAppSettingValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;MyAppSettingValue&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Now we have introduced a breaking change and need to modify our page and our test
to accommodate the change to SomeClassThatNeedsTesting.
&lt;/p&gt;
&lt;p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f53fdd9d-a68d-4e91-9f22-32ae196e840d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Index.aspx.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#6b98ff"&gt;namespace&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;WebApp&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;partial&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;Index&lt;/span&gt;&lt;span style="color:#ffffff"&gt; : &lt;/span&gt;&lt;span style="color:#57ff52"&gt;Page&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;protected&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;void&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;Page_Load&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;object&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;sender&lt;/span&gt;&lt;span style="color:#ffffff"&gt;, &lt;/span&gt;&lt;span style="color:#57ff52"&gt;EventArgs&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;e&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;var&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;someClass&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;AppSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt;());&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#fffec7"&gt;lblValue&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;Text&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;someClass&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeStringValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&gt;
&lt;p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d14b22f1-9bcb-43a8-bb39-08bff6880274" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;SomeClassThatNeedsTesting_Test
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#6b98ff"&gt;namespace&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;TestProject&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;TestClass&lt;/span&gt;&lt;span style="color:#ffffff"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;class&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting_Tests&lt;/span&gt;&lt;span style="color:#ffffff"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;TestMethod&lt;/span&gt;&lt;span style="color:#ffffff"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;HostType&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;ASP.NET&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;UrlToTest&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;http://localhost:2356/Index.aspx&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;AspNetDevelopmentServerHost&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;$(SolutionDir)&amp;#92;&amp;#92;WebApp&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;void&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeStringValue_ShouldReturn_NonNull_NonEmpty_String_ASP&lt;/span&gt;&lt;span style="color:#ffffff"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;someClass&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;AppSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt;());&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;val&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;someClass&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeStringValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#57ff52"&gt;Console&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;WriteLine&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#fffec7"&gt;val&lt;/span&gt;&lt;span style="color:#ffffff"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#57ff52"&gt;Assert&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;IsFalse&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;IsNullOrEmpty&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#fffec7"&gt;val&lt;/span&gt;&lt;span style="color:#ffffff"&gt;));&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&gt;
&lt;p&gt;
At this point we can run our test from above and, after we have taken a bathroom break,
checked Twitter, and made a sandwich, we will notice that the test still passes.&amp;nbsp;
This is true because all we have done is add a layer of abstraction.&amp;nbsp; We have
not changed the core functionality of the process.&amp;nbsp; Now that the layer of abstraction
is in place we can write another test and this time instead of writing more code to
please ASP.NET lets drop that dependency completely by mocking it.
&lt;/p&gt;
&lt;p&gt;
To implement our mock I am going to use my mocking tool of choice, RhinoMocks.&amp;nbsp;
(I am purposefully not supplying a URL here because you should be using NuGet to get
your packages!)
&lt;/p&gt;
&lt;p&gt;
Here is our new and improved test.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:abade754-f404-4f92-ae63-c6381d78bcc6" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;New
And Improved Test
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px;"&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;[&lt;/span&gt;&lt;span style="color:#57ff52"&gt;TestMethod&lt;/span&gt;&lt;span style="color:#ffffff"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;public&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;void&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeSringValue_ShouldReturn_NonNull_NonEmpty_String_Mocked&lt;/span&gt;&lt;span style="color:#ffffff"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#008000"&gt;//Arrange&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;myAppSettingValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;This
is my expected mocked setting value&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#57ff52"&gt;MockRepository&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;_repository&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;MockRepository&lt;/span&gt;&lt;span style="color:#ffffff"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#2b91af"&gt;IAppSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;mockSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;MockRepository&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;GenerateStrictMock&lt;/span&gt;&lt;span style="color:#ff6666"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#2b91af"&gt;IAppSettingsReader&lt;/span&gt;&lt;span style="color:#ff6666"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#fffec7"&gt;mockSettingsReader&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;Expect&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#fffec7"&gt;msr&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;msr&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetAppSettingValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;MyAppSettingValue&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;))&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;Return&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#fffec7"&gt;myAppSettingValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;)&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;Repeat&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;Once&lt;/span&gt;&lt;span style="color:#ffffff"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#fffec7"&gt;_repository&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;ReplayAll&lt;/span&gt;&lt;span style="color:#ffffff"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#008000"&gt;//Act&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;someClass&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#6b98ff"&gt;new&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#57ff52"&gt;SomeClassThatNeedsTesting&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#fffec7"&gt;mockSettingsReader&lt;/span&gt;&lt;span style="color:#ffffff"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#6b98ff"&gt;string&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;val&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#ff6666"&gt;=&lt;/span&gt;&lt;span style="color:#ffffff"&gt; &lt;/span&gt;&lt;span style="color:#fffec7"&gt;someClass&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;GetSomeStringValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#008000"&gt;//Assert&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;&lt;/span&gt;&lt;span style="color:#57ff52"&gt;Assert&lt;/span&gt;&lt;span style="color:#ff6666"&gt;.&lt;/span&gt;&lt;span style="color:#fffec7"&gt;AreEqual&lt;/span&gt;&lt;span style="color:#ffffff"&gt;(&lt;/span&gt;&lt;span style="color:#fffec7"&gt;myAppSettingValue&lt;/span&gt;&lt;span style="color:#ffffff"&gt;, &lt;/span&gt;&lt;span style="color:#fffec7"&gt;val&lt;/span&gt;&lt;span style="color:#ffffff"&gt;, &lt;/span&gt;&lt;span style="color:#ff6bf2"&gt;&amp;quot;Wrong
value returned from GetSomeSringValue&amp;quot;&lt;/span&gt;&lt;span style="color:#ffffff"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#ffffff"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
If you take a look at the test you can see that the first thing that I did was create
my mock AppSettingReader and set my expectations.&amp;nbsp; After that I instantiated
my class under test and passed in the settings reader mock.
&lt;/p&gt;
&lt;p&gt;
Hope you found this useful!&amp;nbsp; &lt;a href="http://www.dotnetdevdude.com/downloads/code/UnitTestingWithAspNetDependency.zip" target="_blank"&gt;Complete
code is available here!&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=1209bc62-b74a-470e-8cea-303d329a5e89" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,1209bc62-b74a-470e-8cea-303d329a5e89.aspx</comments>
      <category>Code</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=3ab9d2d8-8504-4f44-ba11-bbd95b7836e9</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,3ab9d2d8-8504-4f44-ba11-bbd95b7836e9.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,3ab9d2d8-8504-4f44-ba11-bbd95b7836e9.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3ab9d2d8-8504-4f44-ba11-bbd95b7836e9</wfw:commentRss>
      <slash:comments>4</slash:comments>
      <title>To Be Safe–Make Sure It’s Wrapped…In A TransactionScope</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,3ab9d2d8-8504-4f44-ba11-bbd95b7836e9.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2011/04/02/ToBeSafeMakeSureItsWrappedInATransactionScope.aspx</link>
      <pubDate>Sat, 02 Apr 2011 20:19:41 GMT</pubDate>
      <description>&lt;p&gt;
Unit testing certainly does give you the developer a warm fuzzy but that warm fuzzy
can only get you so far.&amp;nbsp; In the end you still have to make sure all your little
pieces of code/functionality play nice together.&amp;nbsp; This requires integration testing
and if we are going to do any sort of testing that we actually expect to be performed
on a regular basis we have to automate it.&amp;nbsp; Automated integration testing often
gets neglected and is substituted with manual testing, which delays finding issues
and adds time to the project timeline.&amp;nbsp; The reason that integration testing is
often neglected is that it requires touching actual data.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
Why is this is an issue:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Someone has to take the time create the data for the testing. 
&lt;li&gt;
The data has to be reset after each test run&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
All of this requires a lot of work, coordination…and a DBA [cringe]!
&lt;/p&gt;
&lt;p&gt;
Let me introduce a scenario where all that is not required.&amp;nbsp; Why can’t we wrap
our tests in a Transaction?
&lt;/p&gt;
&lt;p&gt;
Here’s what I am thinking:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Have a local empty copy of the database. 
&lt;li&gt;
Either in a test-by-test basis or test-suite basis 
&lt;/li&gt;
&lt;ol type="a"&gt;
&lt;li&gt;
Start a transaction (either at the start of your test or on build-up of the test suite) 
&lt;li&gt;
Create your data and put it in the DB 
&lt;li&gt;
Perform your tests on the data you just created and inserted 
&lt;li&gt;
Rollback the transaction&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;
… And Repeat&lt;/li&gt;&gt;
&lt;p&gt;
Here is an example:
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d86d3943-81da-40ac-b727-5f6be18078c2" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; [&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestMethod&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetAllEligible_ShouldReturn_All_Attendess_InThe_Database_Where_IsEligible_Equals_True&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;TransactionScope&lt;/span&gt;&lt;span style="color:#f07800"&gt;())
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Arrange&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;int&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;expectedCount&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff4aff"&gt;1&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Attendee&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;attendee1&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Attendee&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;FirstName&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Joe&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;LastName&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Smith&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;IsEligible&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;true}&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Attendee&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;attendee2&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Attendee&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;FirstName&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Randy&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;LastName&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Jones&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;IsEligible&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;false}&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;var&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;dc&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DayOfDotNetDataContext&lt;/span&gt;&lt;span style="color:#f07800"&gt;())
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;dc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Attendees&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;InsertAllOnSubmit&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;List&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Attendee&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;&lt;span style="color:#dddddd"&gt;attendee1&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;attendee2}&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;dc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;SubmitChanges&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Act&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IAttendeeRepository&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;attendeeRepository&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AttendeeRepository&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;AttendeeDTO&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;attendees&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;attendeeRepository&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetAllEligible&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Assert&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;attendees&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Count&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ShouldEqual&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;expectedCount&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Wrong
number of attendess&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
You can see that the first line of my test starts a transaction scope.&amp;nbsp; I then
create some data and add it to my empty database.&amp;nbsp; Now, remember this database
needs to be empty as to not mess up your expectations.&amp;nbsp; After the data has been
created I then perform the operation I am testing and assert the results.
&lt;/p&gt;
&lt;p&gt;
You may be confused by the lack of a “Rollback” statement.&amp;nbsp; The way TransactionScope
works is that it only commits when explicitly told to do so.
&lt;/p&gt;
&lt;p&gt;
Automated integration testing is a must have and in order to make your life easier
follow the steps I have outlined and you will be free to live the TDD dream! 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=3ab9d2d8-8504-4f44-ba11-bbd95b7836e9" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,3ab9d2d8-8504-4f44-ba11-bbd95b7836e9.aspx</comments>
      <category>Code</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=8915163a-47c7-4c9e-bc5d-551a5464e1df</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,8915163a-47c7-4c9e-bc5d-551a5464e1df.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,8915163a-47c7-4c9e-bc5d-551a5464e1df.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8915163a-47c7-4c9e-bc5d-551a5464e1df</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <title>Adding Enough Abstraction That Your Code Will Work With Any Inversion Of Control Container</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,8915163a-47c7-4c9e-bc5d-551a5464e1df.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/12/17/AddingEnoughAbstractionThatYourCodeWillWorkWithAnyInversionOfControlContainer.aspx</link>
      <pubDate>Fri, 17 Dec 2010 17:06:46 GMT</pubDate>
      <description>&lt;p&gt;
As I have stated in previous posts I am huge supporter of TDD and you can’t get too
far doing true TDD before you are forced to introduce an IoC Container, also known
as a Dependency Injection Container.&amp;nbsp; You can find out more about Inversion of
Control and Dependency Injection &lt;a href="http://www.martinfowler.com/articles/injection.html"&gt;here&lt;/a&gt;.&amp;nbsp;
When I first started looking into using the concept of Inversion Of Control in my
code, my first stop was StructureMap.&amp;nbsp; Why…I can’t really remember but it was
the first IoC framework I tried and it is the one I currently prefer to use.&amp;nbsp;
But, being a consultant I pride myself in knowing my options and being able to work
with or recommend the tool that is best suited for the situation…hence this blog post
and example code.&amp;nbsp; I decided to put together this post and code showing how,
if you plan accordingly, you can swap out any of the *major* IoC Frameworks without
impacting the code.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
I set out with the goal of creating a swappable solution that would allow me work
with the following IoC Frameworks.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;a href="http://code.google.com/p/autofac/"&gt;Autofac&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.castleproject.org/container/index.html"&gt;Castle Windsor&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://code.google.com/p/linfu/"&gt;Linfu&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://ninject.org/"&gt;Ninject&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://www.springframework.net/"&gt;Sprint .NET&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://structuremap.net/structuremap/index.html"&gt;StructureMap&lt;/a&gt; 
&lt;li&gt;
&lt;a href="http://unity.codeplex.com/"&gt;Unity&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Side Note:&amp;nbsp; Using &lt;a href="http://nuget.codeplex.com/"&gt;NuGet&lt;/a&gt; really makes
pulling down tools/packages very easy.&amp;nbsp; Check It Out!
&lt;/p&gt;
&lt;p&gt;
So, let’s get started!&amp;nbsp; The basic principals of setting up and using an IoC container
in code are the same no matter what Container you are using.&amp;nbsp; From the 30,000
foot view you need to:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Map what concrete class implementations to use for what abstract (interface, abstract
class) implementations. 
&lt;li&gt;
Have some way of resolving to a concrete implementation when passed an abstract implementation.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
To get the juices flowing here is how you tackle this in StructureMap.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Create a class that will be called on when our app spins up that will take care of
our abstract –&amp;gt; concrete mappings.&amp;nbsp; Typically this class is called a Bootstrapper.&amp;nbsp;
As you can see this class contains when method called Bootstrap that performs the
mapping.&amp;nbsp; In this example there is one mapping that says (see line 18) whenever
you need a concrete instance of IMyBusinessClass use the MyBusinessClass class.&lt;br&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f7e6d2b1-3be5-47f8-8959-a710549fc970" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;StructureMapBootsrapper
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ChoosingAnIoC&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Business&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ChoosingAnIoC&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Core&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Interfaces&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Business&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;StructureMap&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ChoosingAnIoC&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;App&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Bootsrappers&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; Maps
Abstract to Concrete Implementations Using StructureMap&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;StructureMapBootstrapper&lt;/span&gt;&lt;span style="color:#f07800"&gt; : &lt;/span&gt;&lt;span style="color:#02e836"&gt;IBootstrapper&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt; #region&lt;/span&gt;&lt;span style="color:#f07800"&gt; IBootstrapper
Members&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; Setup
of mappings&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Bootstrap&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ObjectFactory&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Initialize&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;x&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;For&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;IMyBusinessClass&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;()&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Use&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;MyBusinessClass&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;());&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt; #endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;ol start="2"&gt;
&lt;li&gt;
Create a class that can use the IoC containers mappings to hand you a concrete instance
of class on demand.&amp;nbsp; I call this class a Resolver. 
&lt;br&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:ff66bea8-f52f-43fb-bfaa-6c04c73332ae" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;StructureMapDependencyResolver
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ChoosingAnIoC&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Core&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Interfaces&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;StructureMap&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ChoosingAnIoC&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Core&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;DependencyResolvers&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; Class
for resolving dependency&amp;#39;s using StructureMap&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;StructureMapDependencyResolver&lt;/span&gt;&lt;span style="color:#f07800"&gt; : &lt;/span&gt;&lt;span style="color:#02e836"&gt;IDependencyResolver&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; Returns
a concrete instance of the&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; supplied
Interface&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;typeparam
name=&amp;quot;T&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;Interface of concrete instance
to return&lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/typeparam&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;Concrete
instance of the supplied interface&lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; T &lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetConcreteInstanceOf&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;T&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ObjectFactory&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetInstance&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;T&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
If&amp;nbsp; we add enough level of abstraction at these two points we can swap out any
of the current IoC containers and hopefully be able to handle any that come along
in the future.&amp;nbsp; As you probably noticed in the two code examples above…both of
these classes implement an interface.&amp;nbsp; Below is the code for the two interfaces.
&lt;/p&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9af59fb2-e9ba-4565-8934-0fadc1a4d519" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;IBootsrapper
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ChoosingAnIoC&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;App&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Bootsrappers&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; Bootsrapper
Interface&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;interface&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IBootstrapper&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; Bootstrap
and perform mappings&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Bootstrap&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1584cf42-ee0c-4511-b101-889dd32c7019" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;IDependencyResolver
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ChoosingAnIoC&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Core&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Interfaces&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; Interface
for implementations of Dependency Resolver&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;remarks&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; This
interface adds a layer of abstraction when we&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; resolve
dependencies. It will allow us to swap out&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; out
IoC framework with minimal impact on our code.&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/remarks&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;interface&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IDependencyResolver&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; Returns
a concrete instance of the&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; supplied
Interface&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;typeparam
name=&amp;quot;T&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;Interface of concrete instance
to return&lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/typeparam&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;///&lt;/span&gt;&lt;span style="color:#8cff8c"&gt; &lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;Concrete
instance of the supplied interface&lt;/span&gt;&lt;span style="color:#808080"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; T &lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetConcreteInstanceOf&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;T&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt; }&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;/ul&gt;
&lt;p&gt;
Use this code a couple of factory classes to return whatever Bootstrapper and DependencyResolver
our application is configured to use we can swap out IoC containers without affecting
our code.
&lt;/p&gt;
&lt;p&gt;
The complete code including implementations of all the IoC containers noted above
can be found &lt;a href="http://www.dotnetdevdude.com/downloads/code/ChoosingAnIoC.zip"&gt;here&lt;/a&gt;!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=8915163a-47c7-4c9e-bc5d-551a5464e1df" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,8915163a-47c7-4c9e-bc5d-551a5464e1df.aspx</comments>
      <category>Code</category>
      <category>IoC</category>
      <category>Methodology</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=2c06f89d-b637-4ed1-b338-6b0d2cdbe438</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,2c06f89d-b637-4ed1-b338-6b0d2cdbe438.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,2c06f89d-b637-4ed1-b338-6b0d2cdbe438.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=2c06f89d-b637-4ed1-b338-6b0d2cdbe438</wfw:commentRss>
      <slash:comments>8</slash:comments>
      <title>Sharing StyleCop Settings Globally</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,2c06f89d-b637-4ed1-b338-6b0d2cdbe438.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/10/22/SharingStyleCopSettingsGlobally.aspx</link>
      <pubDate>Fri, 22 Oct 2010 21:19:52 GMT</pubDate>
      <description>&lt;p&gt;
At my current client I was tasked with implementing coding standards and styles and
developing a process so the configurations can be easily maintained and shared.&amp;nbsp;
ReSharper was already in place at the client and the since 99% of what they wanted
to enforce, initially at least, was style related I chose to combine ReSharper with
StyleCop.
&lt;/p&gt;
&lt;p&gt;
After looking around the interwebs for awhile I realized this process is either impossible
or undocumented…or both.
&lt;/p&gt;
&lt;p&gt;
The process I came up with is about 90% of what I was hoping and still requires two
manual steps by the developer but overall it is solid.&amp;nbsp; So, let’s get started.&amp;nbsp;
First download and install the following tools:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;a href="http://stylecop.codeplex.com/"&gt;StyleCop&lt;/a&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://stylecopplus.codeplex.com/"&gt;StyleCop+&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Although StyleCop+ is technically not required it does a great job with allowing you
to extend and customize a lot of the built in StyleCop rules.&amp;nbsp; So I certainly
recommend it.
&lt;/p&gt;
&lt;p&gt;
The trick with StyleCop is that it will continue to look up the code tree for settings
files and keep adding them together and then adds the settings file from StyleCop
install directory to top things off.&amp;nbsp; That is unless you tell it to do otherwise.&amp;nbsp;
What where going to do is first place a Settings.StyleCop file where all devlopers
can access it.&amp;nbsp; Next we are going to place another at the root of our code directory.&amp;nbsp;
So if your code resides at C:\Dev\Code then place the Settings.StyleCop file there.&amp;nbsp;
We can then open up the settings file we placed out on the network that everyone has
access to and tell it not to merge with any other settings file.&amp;nbsp; This will be
the official settings file.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Sharing_DD16/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Sharing_DD16/image_thumb.png" width="688" height="435"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Next we will open the settings file in the root of our source tree and tell it merge
only with the settings in the shared location.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Sharing_DD16/image_6.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/Windows-Live-Writer/Sharing_DD16/image_thumb_2.png" width="677" height="374"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Now once you make changes at the shared level they will be merged with each developers
settings file.
&lt;/p&gt;
&lt;p&gt;
Next we can deal with ReSharper…Stay Tuned!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=2c06f89d-b637-4ed1-b338-6b0d2cdbe438" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,2c06f89d-b637-4ed1-b338-6b0d2cdbe438.aspx</comments>
      <category>Code</category>
      <category>ReSharper</category>
      <category>StyleCop</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=399de0da-3636-4114-b1af-b68135c06a53</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,399de0da-3636-4114-b1af-b68135c06a53.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,399de0da-3636-4114-b1af-b68135c06a53.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=399de0da-3636-4114-b1af-b68135c06a53</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <title>Who’s To Blame For *Bad* Design/Code?</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,399de0da-3636-4114-b1af-b68135c06a53.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/09/17/WhosToBlameForBadDesignCode.aspx</link>
      <pubDate>Fri, 17 Sep 2010 13:58:51 GMT</pubDate>
      <description>&lt;p&gt;
Earlier this week I got into a bit of spat with a couple of Tweeps on Twitter.&amp;nbsp;
It started with someone I follow and respect re-tweeting something someone tweeted
about him which basically said the tools which he is associated with aid developers
in creating bad design.&amp;nbsp; I responded to this tweet in support of this person
whom I respect by saying…
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Tools don’t do bad design.&amp;nbsp; Bad developers do bad design.&lt;/strong&gt;
&lt;/p&gt;
&lt;p&gt;
Immediately after tweeting this I got multiple reply’s stating that just because you
do bad design or write bad code you are not necessarily a bad developer.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
To be blunt…this confused the hell out of me.&amp;nbsp; If you knowingly create a bad
design or write bad code how can you be a good developer?&amp;nbsp; I guess the key word
in that previous statement is *knowingly*.&amp;nbsp; But if you don’t know what good design/code
is in my book you can’t be a good developer.
&lt;/p&gt;
&lt;p&gt;
Don’t get me wrong.&amp;nbsp; We have all been in the position when due to forces outside
of our control we have been forced to write imperfect code or create a less than perfect
design.&amp;nbsp; To me this is one place where you can quantifiably determine the good
developer from the bad developer.&amp;nbsp; A good developer, when writing imperfect code
due to factors outside of there control, will do one or more of the following:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Get upset because they know they are writing less than perfect code/design. 
&lt;li&gt;
Leave a comment stating why the code/design was done in this factor. 
&lt;li&gt;
Add a ToDo for refactoring later. 
&lt;li&gt;
Will do the imperfect code/design in such a way that the refactoring effort will require
less effort.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
This argument of writing bad code does not a bad developer make really rattles me.&amp;nbsp;
That is exactly what it does!
&lt;/p&gt;
&lt;p&gt;
OK…Let me have it!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=399de0da-3636-4114-b1af-b68135c06a53" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,399de0da-3636-4114-b1af-b68135c06a53.aspx</comments>
      <category>Code</category>
      <category>Controversial</category>
      <category>General Ranting</category>
      <category>Life</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=28720227-6cfa-48af-a859-84fae78e55aa</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,28720227-6cfa-48af-a859-84fae78e55aa.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,28720227-6cfa-48af-a859-84fae78e55aa.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=28720227-6cfa-48af-a859-84fae78e55aa</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <title>Automated WPF UI Testing Using White</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,28720227-6cfa-48af-a859-84fae78e55aa.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/09/10/AutomatedWPFUITestingUsingWhite.aspx</link>
      <pubDate>Fri, 10 Sep 2010 21:25:00 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=02273ffc-e90c-4d37-884a-3c6bf7f6db12&amp;amp;url=http%3a%2f%2fdotnetdevdude.com%2fBlog%2fct.ashx%3fid%3dab5b6ac7-919e-4aa4-a022-03875f7ba81d%26url%3dhttp%253a%252f%252fdotnetdevdude.com%252fBlog%252fct.ashx%253fid%253db543680f-fc88-45b4-8691-f5751a1c3c7f%2526url%253dhttp%25253a%25252f%25252fwww.DotNetDevDude.com%25252fDownloads%25252fCode%25252fCompositeAppPocWithWhite.zip"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In my &lt;a href="http://DotNetDevDude.com/Blog/2010/08/23/AutomatedWPFUITestingUsingIronRubyAndCucumberWithBewildr.aspx"&gt;previous
post&lt;/a&gt; I covered doing automated user interface testing of a WPF application using
Iron Ruby and Cucumber.&amp;nbsp; The reason I was drawn to this path was my current interest
in Ruby, Rails, and BDD.&amp;nbsp; What made Bewildr such a draw for me, other than writing
my tests in IronRuby, was the fact that I can use with Cucumber and have a truly human-readable
natural language test.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cc577daa-d813-4b51-82e9-5ff48be7c9fd" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;Scenario: The Log On window should be displayed on application
start&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;Given I ensure that there are no instances of &amp;quot;CompositeAppPoc.Shell.exe&amp;quot;
running&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;When I start &amp;quot;C:&amp;#92;&amp;#92;MyCompositeAppPoc.Shell.exe&amp;quot;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;Then 1 window is displayed with name &amp;quot;Log On&amp;quot;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;And Terminate the app&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Again, because of the learning curve and the fact that I would be introducing a completely
new programming language, and let’s face it a completely new way of thinking, into
a corporate environment that I will not be around to support long-term I had to pursue
a more conventional solution, which led me to &lt;a href="http://white.codeplex.com/"&gt;White&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
White is an automated UI testing framework similar to &lt;a href="http://github.com/natritmeyer/bewildr"&gt;Bewildr&lt;/a&gt; in
that they both rely on the &lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=02273ffc-e90c-4d37-884a-3c6bf7f6db12&amp;amp;url=http%3a%2f%2fmsdn.microsoft.com%2fen-us%2flibrary%2fms747327.aspx"&gt;MS
UI Automation Framework&lt;/a&gt; to hook and manipulate the user interface.&amp;nbsp; What
makes White a better choice given my current situation is that from a programmers
perspective it is implemented and reads exactly like the standard .NET test frameworks.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:f9d0bfd3-1596-4773-97f2-6216d2b38711" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestMethod&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnApplicationStart_TheLogOnWindow_ShouldBeDisplayed&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Act&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Window&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;window&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetWindow&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Log
On&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Assert&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;window&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ShouldNotBeNull&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Take a look at the video clip below to see what running a White test looks like.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:5737277B-5D6D-4f48-ABFC-DD9C333F4C5D:1b9bb8ec-a2f0-4494-8338-ba6230ada6bb" class="wlWriterEditableSmartContent"&gt;
&lt;div id="fc0da2c7-6cac-4d1c-8c5a-97b9f90ae933" style="margin: 0px; padding: 0px; display: inline;"&gt;
&lt;div&gt;&lt;a href="http://www.youtube.com/watch?v=_KQx1dlHnio" target="_new"&gt;&lt;img src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/AutomatedWPFUITestingUsingWhite_F202/video411e936fd675.jpg" style="border-style: none" galleryimg="no" onload="var downlevelDiv = document.getElementById('fc0da2c7-6cac-4d1c-8c5a-97b9f90ae933'); downlevelDiv.innerHTML = &amp;quot;&amp;lt;div&amp;gt;&amp;lt;object width=\&amp;quot;299\&amp;quot; height=\&amp;quot;249\&amp;quot;&amp;gt;&amp;lt;param name=\&amp;quot;movie\&amp;quot; value=\&amp;quot;http://www.youtube.com/v/_KQx1dlHnio&amp;amp;hl=en\&amp;quot;&amp;gt;&amp;lt;\/param&amp;gt;&amp;lt;embed src=\&amp;quot;http://www.youtube.com/v/_KQx1dlHnio&amp;amp;hl=en\&amp;quot; type=\&amp;quot;application/x-shockwave-flash\&amp;quot; width=\&amp;quot;299\&amp;quot; height=\&amp;quot;249\&amp;quot;&amp;gt;&amp;lt;\/embed&amp;gt;&amp;lt;\/object&amp;gt;&amp;lt;\/div&amp;gt;&amp;quot;;" alt=""&gt;&lt;/a&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Getting up and running with White is very easy.&amp;nbsp; Other than downloading the binaries
from CodePlex all you need is a tool like &lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=02273ffc-e90c-4d37-884a-3c6bf7f6db12&amp;amp;url=http%3a%2f%2fwww.dotnetdevdude.com%2fdownloads%2fuispy.zip"&gt;UISpy&lt;/a&gt; to
help you dig deep into how the UI elements are rendered.
&lt;/p&gt;
&lt;p&gt;
At the highest level White operates on the concepts of Application and Windows.&amp;nbsp;
Application being the application you are testing and Windows being the main surface
of the application.&amp;nbsp; As a best practice I would recommend spinning up the application,
retrieving your window(s) and killing your application as part of test setup and teardown.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a260fc26-f5c3-4469-b200-8b3e32fb2396" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#region&lt;/span&gt;&lt;span style="color:#f07800"&gt; Private Fields&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Application&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Window&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_window&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;#region&lt;/span&gt;&lt;span style="color:#f07800"&gt; Setup &amp;amp;
Tear Down&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestInitialize&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;MyTestInitialize&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Application&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Launch&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;@&amp;quot;c:&amp;#92;pathtomyapp&amp;#92;myapp.exe&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_window&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetWindow&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;MyWindow&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestCleanup&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;MyTestCleanup&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Kill&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
With all that in place let’s walk through setting up a couple tests.
&lt;/p&gt;
&lt;p&gt;
The first thing I want to test is that when my application spins up for the first
time the Log On window is displayed.&amp;nbsp; Because this is an Application level test
I am going to put it in a test class called ApplicationTests.&amp;nbsp; I will use the
practice of spinning up the app and killing it as I described above.&amp;nbsp; My test
will simply attempt to retrieve a window with title “Log On” and make sure it is not
null.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:9053524e-1be7-43ec-bf1b-7fd8cb234f0d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestClass&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ApplicationTests&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#region&lt;/span&gt;&lt;span style="color:#f07800"&gt; Private Fields&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Application&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#region&lt;/span&gt;&lt;span style="color:#f07800"&gt; Setup &amp;amp;
Tear Down&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestInitialize&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;MyTestInitialize&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Application&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Launch&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#ff3264"&gt;@&amp;quot;c:&amp;#92;wpf&amp;#92;compositeapppoc&amp;#92;compositeapppoc.shell&amp;#92;compositeapppoc.shell&amp;#92;bin&amp;#92;debug&amp;#92;compositeapppoc.shell.exe&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestCleanup&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;MyTestCleanup&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Kill&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestMethod&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnApplicationStart_TheLogOnWindow_ShouldBeDisplayed&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Act&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Window&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;window&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetWindow&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Log
On&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Assert&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;window&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ShouldNotBeNull&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
My next test is going to be to make sure that when I enter an invalid username and
password and click the log on button a message is displayed telling me my credentials
are not valid.&amp;nbsp; Because this test is specific to the Log On window I am going
to create a new test class called LogOnTests.&amp;nbsp; I will use the practice of spinning
up the app, getting my window and killing the app as I described above.&amp;nbsp; My test
will enter an invalid username and password, click the log on button, and verify that
the error message label is visible.
&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:1ffc5f5e-8244-41b7-a47d-cba8044ecb52" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestClass&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;LogOnTests&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;#region&lt;/span&gt;&lt;span style="color:#f07800"&gt; Private Fields&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Application&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Window&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_window&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#region&lt;/span&gt;&lt;span style="color:#f07800"&gt; Setup &amp;amp;
Tear Down&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestInitialize&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;MyTestInitialize&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Application&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Launch&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#ff3264"&gt;@&amp;quot;c:&amp;#92;wpf&amp;#92;compositeapppoc&amp;#92;compositeapppoc.shell&amp;#92;compositeapppoc.shell&amp;#92;bin&amp;#92;debug&amp;#92;compositeapppoc.shell.exe&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_window&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetWindow&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Log
On&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestCleanup&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;MyTestCleanup&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Kill&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;TestMethod&lt;/span&gt;&lt;span style="color:#f07800"&gt;]&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Entering_InvalidCredentials_AndClickingThe_LogOnButton_ShouldDisplayThe_InvalidCredentialsMessage&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Arrange&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_window&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Get&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;TextBox&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;txtUsername&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Text&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;InvalidUsername&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_window&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Get&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;TextBox&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;txtPassword&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;)&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Text&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;InvalidPassword&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;var&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;btn&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_window&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Get&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Button&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;btnLogOn&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Act&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;btn&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Click&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_window&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_app&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetWindow&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;Log
On&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#8cff8c"&gt;//Assert&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_window&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Get&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Label&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;lblErrorMessage&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;))&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Visible&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ShouldBeTrue&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
It’s that easy.&amp;nbsp; With very little effort you can have a full suite of automated
tests for testing your UI.&amp;nbsp; How cool is that!?
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=02273ffc-e90c-4d37-884a-3c6bf7f6db12&amp;amp;url=http%3a%2f%2fdotnetdevdude.com%2fBlog%2fct.ashx%3fid%3dab5b6ac7-919e-4aa4-a022-03875f7ba81d%26url%3dhttp%253a%252f%252fdotnetdevdude.com%252fBlog%252fct.ashx%253fid%253db543680f-fc88-45b4-8691-f5751a1c3c7f%2526url%253dhttp%25253a%25252f%25252fwww.DotNetDevDude.com%25252fDownloads%25252fCode%25252fCompositeAppPocWithWhite.zip"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=28720227-6cfa-48af-a859-84fae78e55aa" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,28720227-6cfa-48af-a859-84fae78e55aa.aspx</comments>
      <category>BDD</category>
      <category>Code</category>
      <category>Composite Apps</category>
      <category>MVVM</category>
      <category>TDD</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=02273ffc-e90c-4d37-884a-3c6bf7f6db12</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,02273ffc-e90c-4d37-884a-3c6bf7f6db12.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,02273ffc-e90c-4d37-884a-3c6bf7f6db12.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=02273ffc-e90c-4d37-884a-3c6bf7f6db12</wfw:commentRss>
      <slash:comments>86</slash:comments>
      <title>Automated WPF UI Testing Using IronRuby and Cucumber with Bewildr</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,02273ffc-e90c-4d37-884a-3c6bf7f6db12.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/08/23/AutomatedWPFUITestingUsingIronRubyAndCucumberWithBewildr.aspx</link>
      <pubDate>Mon, 23 Aug 2010 23:04:00 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=ab5b6ac7-919e-4aa4-a022-03875f7ba81d&amp;amp;url=http%3a%2f%2fdotnetdevdude.com%2fBlog%2fct.ashx%3fid%3db543680f-fc88-45b4-8691-f5751a1c3c7f%26url%3dhttp%253a%252f%252fwww.DotNetDevDude.com%252fDownloads%252fCode%252fCompositeAppPocWithCucumber.zip"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
In an attempt to be a &lt;a href="http://www.pragprog.com/the-pragmatic-programmer" target="_blank"&gt;Pragmatic
Programmer&lt;/a&gt; I make an effort to learn a new programming language yearly.&amp;nbsp;
This year the language of choice is Ruby, including &lt;a href="http://rubyonrails.org/" target="_blank"&gt;Rails&lt;/a&gt;.&amp;nbsp;
About a month ago I started the Build Your Own Blog :: Rails series at &lt;a href="http://tekpub.com/" target="_blank"&gt;TekPub&lt;/a&gt;.&amp;nbsp;
In this series &lt;a href="http://blog.wekeroad.com/" target="_blank"&gt;Rob Conery&lt;/a&gt; instructs
on creating a blog engine using Rails and focusing on &lt;a href="http://en.wikipedia.org/wiki/Behavior_Driven_Development" target="_blank"&gt;Behavior
Driven Development&lt;/a&gt;.&amp;nbsp; Rob introduces some amazing tools, such as &lt;a href="http://cukes.info/" target="_blank"&gt;Cucumber&lt;/a&gt; and &lt;a href="http://ianwhite.github.com/pickle/" target="_blank"&gt;Pickle&lt;/a&gt;,
that make BDD on Rails easy and dare I say…fun!
&lt;/p&gt;
&lt;p&gt;
If you have been following along at home with my previous serious of blog posts you
know that in my day job I am currently architecting a large WPF MVVM composite application
using Prism.&amp;nbsp; My development methodology for .Net development is TDD and not
BDD, because I just don’t feel the tools are there yet in the .Net space for efficient
BDD.&amp;nbsp; I am at the point in the project where I am starting work on the UI and
being fresh of learning the wonderful BDD tools available in the Rails stack it was
really annoying me that I had no way to TDD my UI.&amp;nbsp; Grant it, using MVVM I was
able to get much closer to the actual UI than I otherwise would, but it still wasn’t
the same.&amp;nbsp; Finally I got to the point where I just had to research the idea of
Cucumber style testing in WPF.&amp;nbsp; What I found out was it is possible using IronRuby.&amp;nbsp;
Don’t be mistaken, it does not offer the same ease and simplicity as it does on the
Rails stack but it is certainly a leap in the right direction.
&lt;/p&gt;
&lt;p&gt;
The tool that is going to make this all possible was written by &lt;a href="http://www.natontesting.com/" target="_blank"&gt;Nathaniel
Ritmeyer&lt;/a&gt; and is called &lt;a href="http://wiki.github.com/natritmeyer/bewildr/" target="_blank"&gt;Bewildr&lt;/a&gt;! 
&lt;/p&gt;
&lt;p&gt;
Here are the steps to getting your environment setup…
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Follow the steps in my &lt;a href="http://dotnetdevdude.com/Blog/2010/08/13/GettingCucumberUpAndRunningWithIronRuby.aspx" target="_blank"&gt;previous
blog post&lt;/a&gt; to get Ruby, IronRuby, and Cucumber installed.&amp;nbsp; 
&lt;li&gt;
Install Bewildr.&lt;br&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/AutomatedWPFUITestingUsingIronRubyandCuc_6B9B/image_10.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/AutomatedWPFUITestingUsingIronRubyandCuc_6B9B/image_thumb_4.png" width="208" height="23"&gt;&lt;/a&gt; 
&lt;li&gt;
Install &lt;a href="http://www.dotnetdevdude.com/downloads/uispy.zip" target="_blank"&gt;UISpy&lt;/a&gt;. 
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
I am going to be testing the UI created in my previous series: &lt;a href="http://DotNetDevDude.com/Blog/2010/08/16/RollingYourOwnModuleLevelSecurityForAWPFMVVMCompositeApplication.aspx"&gt;Rolling
Your Own Module Level Security for a WPF MVVM Composite Application&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Detailed information on Cucumber can be found &lt;a href="http://wiki.github.com/aslakhellesoy/cucumber/" target="_blank"&gt;here&lt;/a&gt;.&amp;nbsp;
But, basically Cucumber allows you to write plain-text functional descriptions as
automated tests.&amp;nbsp; Cucumber code consists of two main pieces; &lt;a href="http://wiki.github.com/aslakhellesoy/cucumber/feature-introduction" target="_blank"&gt;Features/Scenarios&lt;/a&gt; and &lt;a href="http://wiki.github.com/aslakhellesoy/cucumber/step-definitions" target="_blank"&gt;Step
Definitions&lt;/a&gt;.&amp;nbsp; This is not meant to be a Cucumber tutorial so if you are not
familiar with Cucumber I would suggest reading up on it prior to continuing.
&lt;/p&gt;
&lt;p&gt;
OK.&amp;nbsp; So, now that your familiar with Cucumber you are probably asking yourself
how is this going to allow me to do automated UI testing?&amp;nbsp; This is where Bewildr
enters the party.&amp;nbsp; Bewildr is a Ruby GEM that uses the &lt;a href="http://msdn.microsoft.com/en-us/library/ms747327.aspx" target="_blank"&gt;MS
UI Automation Framework&lt;/a&gt; to gain programmatic access to a WPF UI.&amp;nbsp; Basically,
I can spin up a WPF application and manipulate the UI, click buttons, enter text in
text boxes, etc, all via code.
&lt;/p&gt;
&lt;p&gt;
So, let’s start with a simple scenario.&amp;nbsp; (I apologize for the formatting/highlighting…need
to find a good formatter plug-in for Cucumber code.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:afedfd74-fc8a-4a26-8e41-f3652e7fd524" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;application.feature
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;@application&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;@window&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;Feature: Application Interaction&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;Scenario: The Log On window should be displayed on application
start&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;Given I ensure that there are no instances of &amp;quot;CompositeAppPoc.Shell.exe&amp;quot;
running&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;When I start &amp;quot;C:&amp;#92;&amp;#92;development&amp;#92;&amp;#92;research&amp;#92;&amp;#92;wpf&amp;#92;&amp;#92;CompositeAppPoc&amp;#92;&amp;#92;CompositeAppPoc.Shell&amp;#92;&amp;#92;CompositeAppPoc.Shell&amp;#92;&amp;#92;bin&amp;#92;&amp;#92;Debug&amp;#92;&amp;#92;CompositeAppPoc.Shell.exe&amp;quot;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;Then 1 window is displayed with name &amp;quot;Log On&amp;quot;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;And Terminate the app&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
If we go ahead and run this feature Cucumber is going to puke on us because we haven’t
created our steps yet.&amp;nbsp; But, when Cucumber pukes…it pukes in a helpful way.&amp;nbsp;
It is going to give us the shell for the steps we need to create in order to execute
this feature.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/AutomatedWPFUITestingUsingIronRubyandCuc_6B9B/image_19.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/AutomatedWPFUITestingUsingIronRubyandCuc_6B9B/image_thumb_5.png" width="860" height="461"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
As you can see Cucumber lets us know that we need to define 4 steps in order to get
our Feature and Scenario running.&amp;nbsp; So let’s do that.&amp;nbsp; Since 3 of the steps
deal with the application itself and 1 deals specifically with a window I am going
to create 2 step files.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:a1e1808a-e99a-40eb-9f08-7ba3beb7e56d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;application_steps.rb
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;require &amp;#39;bewildr&amp;#39;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;Given /^I ensure that there are no instances of &amp;quot;([^&amp;quot;]*)&amp;quot;
running$/ do |app|&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;Bewildr::Application.kill_all_processes_with_name(app)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;end&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;When /^I start &amp;quot;([^&amp;quot;]*)&amp;quot;$/ do |app|&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;@application = Bewildr::Application.start(app)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;end&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;When /^Terminate the app$/ do&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;@application.kill&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;end&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c6444b58-e061-425e-b899-11cf03c8a3df" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;window_steps.rb
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;require &amp;#39;bewildr&amp;#39;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;Then /^ (&amp;#92;d+) window is displayed with name &amp;quot;([^&amp;quot;]*)&amp;quot;$/
do |count,name|&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;@window = @application.wait_for_window(name)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;@application.windows.size.should == count.to_i&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;@window.name.should match(name)&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;end&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
In the steps coded above you can begin to see what Bewildr allows us to do.&amp;nbsp;
Now if you run this feature you should see the output below as well as the app physically
spinning up and closing.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/AutomatedWPFUITestingUsingIronRubyandCuc_6B9B/image_21.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/AutomatedWPFUITestingUsingIronRubyandCuc_6B9B/image_thumb_8.png" width="867" height="231"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
And as you can see our scenario passed.
&lt;/p&gt;
&lt;p&gt;
This is really just scratching the surface of what you can do.&amp;nbsp; I would suggest
downloading the code and get an understanding of some of the more advanced scenarios
and then start creating your own.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=ab5b6ac7-919e-4aa4-a022-03875f7ba81d&amp;amp;url=http%3a%2f%2fdotnetdevdude.com%2fBlog%2fct.ashx%3fid%3db543680f-fc88-45b4-8691-f5751a1c3c7f%26url%3dhttp%253a%252f%252fwww.DotNetDevDude.com%252fDownloads%252fCode%252fCompositeAppPocWithCucumber.zip"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=02273ffc-e90c-4d37-884a-3c6bf7f6db12" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,02273ffc-e90c-4d37-884a-3c6bf7f6db12.aspx</comments>
      <category>BDD</category>
      <category>Code</category>
      <category>Cucumber</category>
      <category>IronRuby</category>
      <category>Ruby</category>
      <category>TDD</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=ab5b6ac7-919e-4aa4-a022-03875f7ba81d</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,ab5b6ac7-919e-4aa4-a022-03875f7ba81d.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,ab5b6ac7-919e-4aa4-a022-03875f7ba81d.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ab5b6ac7-919e-4aa4-a022-03875f7ba81d</wfw:commentRss>
      <slash:comments>39</slash:comments>
      <title>Rolling Your Own Module Level Security for a WPF MVVM Composite Application</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,ab5b6ac7-919e-4aa4-a022-03875f7ba81d.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/08/16/RollingYourOwnModuleLevelSecurityForAWPFMVVMCompositeApplication.aspx</link>
      <pubDate>Mon, 16 Aug 2010 22:40:00 GMT</pubDate>
      <description>&lt;p&gt;
Note: This expands on the code created in my previous post: &lt;a href="http://DotNetDevDude.com/Blog/2010/08/09/RequiringLogOnInAWPFMVVMCompositeApplication.aspx"&gt;Requiring
Log-On in a WPF MVVM Composite Application&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=b543680f-fc88-45b4-8691-f5751a1c3c7f&amp;amp;url=http%3a%2f%2fwww.DotNetDevDude.com%2fDownloads%2fCode%2fCompositeAppPocWithSecurity.zip"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Continuing on my WPF MVVM Adventures...&amp;nbsp; &lt;/strong&gt;Well, I am still waiting
on the business to finalize the requirements so I am going to take a shot at coding
it to what I think the final specs will be.&amp;nbsp; Although this is a very common situation,
when you take this slippery slope you need to be careful that you don’t end up creating
throw away code.&amp;nbsp;&amp;nbsp; Make sure you:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Program to Interfaces. (FYI – you should be doing this anyway!) 
&lt;li&gt;
Add Abstraction layers that will allow you to swap out implementation. (See step 1) 
&lt;li&gt;
Keep all the possible solutions to the problem in mind when designing/coding.&amp;nbsp;
In my case I am 99% certain the business will want security down to the composite
module level, but I am still going to leave paths open that will allow me to implement
field level security without too much re-work.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
The first thing I need is to define by security roles.&amp;nbsp; Since the actual roles
are TBD I am just going to create a simple Enumeration.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:b30b4708-6108-4e18-b303-630a3b28df63" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Enumerations.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Enumerations&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;enum&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthorizationLevel&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ReadOnly&lt;/span&gt;&lt;span style="color:#f07800"&gt;,&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ReadWrite&lt;/span&gt;&lt;span style="color:#f07800"&gt;,&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Admin&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
In thinking about what the Authentication method of my yet to be created service will
return I decided it was going to need to return multiple things.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Boolean representing whether or not the credentials where able to be authenticated. 
&lt;li&gt;
Level of authorization granted to credentials. 
&lt;li&gt;
List of modules that credentials are able to view.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Knowing I was going to need to return multiple values I created a &lt;a href="http://en.wikipedia.org/wiki/Data_transfer_object" target="_blank"&gt;data
transfer object (DTO)&lt;/a&gt; to handle it.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:7570bf87-0ed4-40b6-8404-8bf149236ab7" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;AuthenticationContext.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;System&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Collections&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Generic&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Enumerations&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;DataTransferObjects&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthenticationContext&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;bool&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;IsAuthorized&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthorizationLevel&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;AuthLevel&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;AllowedModules&lt;/span&gt;&lt;span style="color:#f07800"&gt; { &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;get&lt;/span&gt;&lt;span style="color:#f07800"&gt;; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;set&lt;/span&gt;&lt;span style="color:#f07800"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Now I can create my service.&amp;nbsp; This is going to reside in my Infrastructure project
and will allow me to push(abstract) the implementation of the actual authentication
farther down the stack.&amp;nbsp; Sticking to what I recommended at the beginning of this
post I am going to create a simple interface for the service.&amp;nbsp; The interface
will declare one signature, Authenticate, that accepts a username and password and
returns an AuthenticationContext.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:337acce1-e4de-4533-b51e-be363b77c450" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;IAuthenticationService
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;DataTransferObjects&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Interfaces&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;interface&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IAuthenticationService&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthenticationContext&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Authenticate&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;userName&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;password&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Next we need to code the actual implementation of IAuthenticationService.&amp;nbsp; At
this time the implementation of Authenticate will need to perform the actual authentication,
which will set the IsAuthorized flag as well as the AuthLevel, and determine what
modules are viewable for the AuthLevel.&amp;nbsp; Because I still have not defined the
details of these process I am going to “stub” them out with a trivial implementation.
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:6f69e54c-ecdd-4a15-a1a8-19c3d1acf395" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;AuthenticationService.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;System&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Collections&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Generic&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Constants&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;DataTransferObjects&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Enumerations&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Interfaces&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Services&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthenticationService&lt;/span&gt;&lt;span style="color:#f07800"&gt; : &lt;/span&gt;&lt;span style="color:#02e836"&gt;IAuthenticationService&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;readonly&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthenticationContext&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthenticationContext&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthenticationContext&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Authenticate&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;userName&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;password&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Authorize&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;userName&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;password&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;if&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;IsAuthorized&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetApprovedModules&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Authorize&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;userName&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;password&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;if&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#dddddd"&gt;userName&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Equals&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;admin&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;) &lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;password&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Equals&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;pass&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;))
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;IsAuthorized&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;true&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;AuthLevel&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthorizationLevel&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Admin&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;else&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;if&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#dddddd"&gt;userName&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Equals&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;readwrite&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;) &lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;password&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Equals&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;pass&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;))
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;IsAuthorized&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;true&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;AuthLevel&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthorizationLevel&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ReadWrite&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;else&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;if&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#dddddd"&gt;userName&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Equals&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;readonly&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;) &lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;amp;&amp;amp;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;password&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Equals&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#ff3264"&gt;&amp;quot;pass&amp;quot;&lt;/span&gt;&lt;span style="color:#f07800"&gt;))
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;IsAuthorized&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;true&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;AuthLevel&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthorizationLevel&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ReadOnly&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetApprovedModules&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;modules&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;List&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;switch&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;AuthLevel&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;case&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthorizationLevel&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Admin&lt;/span&gt;&lt;span style="color:#f07800"&gt;:&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;modules&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Add&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#02e836"&gt;EmployeeConstants&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;EmployeeEditModuleName&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;modules&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Add&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#02e836"&gt;EmployeeConstants&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;EmployeeCreateModuleName&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;break&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;case&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthorizationLevel&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ReadWrite&lt;/span&gt;&lt;span style="color:#f07800"&gt;:&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;modules&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Add&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#02e836"&gt;EmployeeConstants&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;EmployeeCreateModuleName&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;break&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;_authenticationContext&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;AllowedModules&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;modules&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Now we need to hop over the Shell project and start making adding in the hooks for
our module level security.
&lt;/p&gt;
&lt;p&gt;
This first I am going to do is change how the modules are loaded.&amp;nbsp; Initially
I used the ConfigurationModuleCatalog which loads the modules from a configuration
file.&amp;nbsp; I decided against this approach because I wanted to avoid configuration
changes when a module was added or removed.&amp;nbsp; Luckily Prism provides another option
called the DirectoryModuleCatalog.&amp;nbsp; This allows you to supply a directory path
that contains the dll’s for your modules.&amp;nbsp; So, all that needs to be done in order
to add a new module is to drop its dll’s in that directory.&amp;nbsp; This change needs
to implemented in the bootstrapper and while we are in there we need to tell our IOC
container how to wire up our AuthenticationService.
&lt;/p&gt;
&lt;p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:77a586ea-9692-48c1-a6e2-ff4e0271a6f4" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;Bootstrapper.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2.5em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;System&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Windows&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Interfaces&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Services&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Microsoft&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Practices&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Composite&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Modularity&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Microsoft&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Practices&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Composite&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;UnityExtensions&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;using&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Microsoft&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Practices&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Unity&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#5ebbd7"&gt;namespace&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Shell&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Bootstrapper&lt;/span&gt;&lt;span style="color:#f07800"&gt; : &lt;/span&gt;&lt;span style="color:#02e836"&gt;UnityBootstrapper&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;protected&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;override&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DependencyObject&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;CreateShell&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;Shell&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;shell&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Shell&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;shell&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Show&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;shell&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;protected&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;override&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;IModuleCatalog&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;GetModuleCatalog&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;return&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;DirectoryModuleCatalog&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ModulePath&lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Infrastructure&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Constants&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#02e836"&gt;GeneralConstants&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ModulePath}&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;protected&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;override&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;ConfigureContainer&lt;/span&gt;&lt;span style="color:#f07800"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;base&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ConfigureContainer&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Container&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;RegisterType&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;IAuthenticationService&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#02e836"&gt;AuthenticationService&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ContainerControlledLifetimeManager&lt;/span&gt;&lt;span style="color:#f07800"&gt;());&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Container&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;RegisterType&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;IEmployeeDataService&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#02e836"&gt;EmployeeDataService&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ContainerControlledLifetimeManager&lt;/span&gt;&lt;span style="color:#f07800"&gt;());&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Container&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;RegisterType&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;IModuleManager&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#02e836"&gt;ModuleManager&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ContainerControlledLifetimeManager&lt;/span&gt;&lt;span style="color:#f07800"&gt;());&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
So now that we did that we can more easily add new modules but it’s still all or nothing.&amp;nbsp;
We need to tell Prism to not load certain modules until we tell it to…load on demand.&amp;nbsp;
This is accomplished by simply by decorating the modules you want to load on demand
with the Module attribute and setting the ModuleName and OnDemand properties.&amp;nbsp;
As you can guess we are going to set the OnDemand property to “True”.&amp;nbsp; This tells
Prism, when it is processing the modules in the directory we tell it, not to load
the module just yet.&amp;nbsp; Prism notes the name of the module and waits for us to
tell it when to load it.&amp;nbsp; We will do this on the EmployeeEditModule, and EmployeeCreateModule
which will both require authorization but we will not do this to the EmployeeListModule
because that module is viewable by all.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:fc8ab1b9-8c38-48da-ba46-01d3c27cd68d" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;EmployeeEditModule.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Module&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ModuleName&lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#02e836"&gt;EmployeeConstants&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;EmployeeEditModuleName&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnDemand&lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;true&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;EmployeeEditModule&lt;/span&gt;&lt;span style="color:#f07800"&gt; : &lt;/span&gt;&lt;span style="color:#02e836"&gt;IModule&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:955c1f81-0ab6-42af-8c45-9ad290bb3dec" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;EmployeeCreateModule.cs
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;[&lt;/span&gt;&lt;span style="color:#02e836"&gt;Module&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ModuleName&lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#02e836"&gt;EmployeeConstants&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;EmployeeCreateModuleName&lt;/span&gt;&lt;span style="color:#f07800"&gt;, &lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnDemand&lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;true&lt;/span&gt;&lt;span style="color:#f07800"&gt;)]&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;class&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;EmployeeCreateModule&lt;/span&gt;&lt;span style="color:#f07800"&gt; : &lt;/span&gt;&lt;span style="color:#02e836"&gt;IModule&lt;/span&gt;&lt;span style="color:#f07800"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Now when you run the the shell you won’t be able to edit or create a new employee
because those modules are not loaded which means that nothing is registered to the
associated commands. 
&lt;/p&gt;
&lt;p&gt;
We already have the list of allowed secured modules being returned from the authentication
service so we just need to write a method to process the list and load the modules.&amp;nbsp;
This method will be in the Bootstrapper and it will load the allowed secured modules
using the Module Manager.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d181aa62-17b5-4c93-b815-1ef8ca128744" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;LoadSecuredModules
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;public&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;LoadSecuredModules&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;allowedModules&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;var&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;moduleManager&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;Container&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Resolve&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#02e836"&gt;IModuleManager&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;foreach&lt;/span&gt;&lt;span style="color:#f07800"&gt; (&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;module&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;in&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;allowedModules&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;moduleManager&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;LoadModule&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;module&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Lastly we need to call LoadSecuredModules.&amp;nbsp; We will do this as the last step
in the App.xaml’s StartUp method.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:48e92cb7-188c-4c7b-8ca2-bcaa114e3f77" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: #000080 1px solid; color: #000; font-family: 'Courier New', Courier, Monospace; font-size: 10pt"&gt;
&lt;div style="background: #000080; color: #fff; font-family: Verdana, Tahoma, Arial, sans-serif; font-weight: bold; padding: 2px 5px"&gt;StartUp
&lt;/div&gt;
&lt;div style="background: #ddd; overflow: auto"&gt;
&lt;ol style="background: #000000; margin: 0 0 0 2em; padding: 0 0 0 5px; white-space: nowrap"&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;private&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;static&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;void&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;StartUp&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#02e836"&gt;IList&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;string&lt;/span&gt;&lt;span style="color:#ffff00"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;allowedModules&lt;/span&gt;&lt;span style="color:#f07800"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Current&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;MainWindow&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;null&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Current&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;ShutdownMode&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;ShutdownMode&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;OnMainWindowClose&lt;/span&gt;&lt;span style="color:#f07800"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;var&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#dddddd"&gt;bs&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#ffff00"&gt;=&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#5ebbd7"&gt;new&lt;/span&gt;&lt;span style="color:#f07800"&gt; &lt;/span&gt;&lt;span style="color:#02e836"&gt;Bootstrapper&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;bs&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;Run&lt;/span&gt;&lt;span style="color:#f07800"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: #0c0c0c"&gt;
&lt;span style="color:#f07800"&gt;&lt;/span&gt;&lt;span style="color:#dddddd"&gt;bs&lt;/span&gt;&lt;span style="color:#ffff00"&gt;.&lt;/span&gt;&lt;span style="color:#dddddd"&gt;LoadSecuredModules&lt;/span&gt;&lt;span style="color:#f07800"&gt;(&lt;/span&gt;&lt;span style="color:#dddddd"&gt;allowedModules&lt;/span&gt;&lt;span style="color:#f07800"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color:#f07800"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Now when we log in with a read-only id (readonly,pass) the edit and create new buttons
are not enabled because the modules are not loaded.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/RollingYourOwnModuleLevelSecurityinWPFMV_A79D/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/RollingYourOwnModuleLevelSecurityinWPFMV_A79D/image_thumb.png" width="648" height="418"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=b543680f-fc88-45b4-8691-f5751a1c3c7f&amp;amp;url=http%3a%2f%2fwww.DotNetDevDude.com%2fDownloads%2fCode%2fCompositeAppPocWithSecurity.zip"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=ab5b6ac7-919e-4aa4-a022-03875f7ba81d" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,ab5b6ac7-919e-4aa4-a022-03875f7ba81d.aspx</comments>
      <category>Code</category>
      <category>Composite Apps</category>
      <category>MVVM</category>
      <category>Security</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=a04ed319-0b9c-4652-965f-e5991e9a7418</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,a04ed319-0b9c-4652-965f-e5991e9a7418.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,a04ed319-0b9c-4652-965f-e5991e9a7418.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=a04ed319-0b9c-4652-965f-e5991e9a7418</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <title>Getting Cucumber Up And Running With IronRuby</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,a04ed319-0b9c-4652-965f-e5991e9a7418.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/08/13/GettingCucumberUpAndRunningWithIronRuby.aspx</link>
      <pubDate>Fri, 13 Aug 2010 22:00:00 GMT</pubDate>
      <description>&lt;p&gt;
In doing some research I found that it is possible to do Rails type BDD/testing in
WPF using IronRuby.&amp;nbsp; I am very excited about this and will be doing an in-depth
post on this in the very near future.&amp;nbsp; But, for now I wanted to get a post out
on how to get Cucumber up and running in IronRuby because in attempting to do this
myself I ran into an issue that turns out is fairly well-known but as far as I can
tell is not documented.&amp;nbsp; I would like to thank &lt;a href="http://www.natontesting.com" target="_blank"&gt;Nathaniel
Ritmeyer, aka NatOnTesting&lt;/a&gt;, for helping me through this and take a look at his &lt;a href="http://wiki.github.com/natritmeyer/bewildr/" target="_blank"&gt;Bewildr&lt;/a&gt; gem…it
will be a key piece of my future post.
&lt;/p&gt;
&lt;p&gt;
Here are the steps for getting Cucumber up and running with IronRuby:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;a href="http://www.ruby-lang.org/en/downloads/" target="_blank"&gt;Install Ruby&lt;/a&gt; (to
save headaches install to c:\ruby and make sure “c:\ruby\bin” is in your Path environment
variable) 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://ironruby.net/" target="_blank"&gt;Install IronRuby&lt;/a&gt; (to save headaches
install to c:\ironruby and make sure “c:\ironruby\bin” is in your Path environment
variable) 
&lt;/li&gt;
&lt;li&gt;
Install Cucumber (here is the undocumented part…until now) 
&lt;ol type="a"&gt;
&lt;li&gt;
Because Gherkin is required by Cucumber version &amp;gt; 0.6.3 and Gherkin is not compatible
with IronRuby we need to install Cucumber version &amp;lt;= 0.6.3. 
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/GettingCucumberUpAndRunningWithIronRuby_8C7C/image_6.png"&gt;&lt;img style="border-width: 0px; margin-top: 10px; display: inline;" title="image" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/GettingCucumberUpAndRunningWithIronRuby_8C7C/image_thumb_2.png" width="364" border="0" height="22"&gt;&lt;/a&gt; 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
Next you need to create a Cucumber wrapper script for IronRuby 
&lt;ol type="a"&gt;
&lt;li&gt;
Go to c:\ruby\bin 
&lt;/li&gt;
&lt;li&gt;
Create a blank text file “icucumber.bat” 
&lt;/li&gt;
&lt;li&gt;
Open icucumber.bat in text editor 
&lt;/li&gt;
&lt;li&gt;
Enter this text 
&lt;ol&gt;
&lt;li&gt;
&lt;p style="background-color: black; width: 500px; color: rgb(0, 255, 0); font-family: Courier New;"&gt;
@ECHO OFF&lt;br&gt;
SET GEM_PATH=c:\ruby\lib\ruby\gems\1.9.1&lt;br&gt;
@"C:\IronRuby\bin\ir.exe" "c:\Ruby\bin\cucumber" %*
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
Save the file&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
Test it (results are truncated) 
&lt;p&gt;
&lt;img style="border-width: 0px; margin-top: -10px; display: inline;" title="image" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/GettingCucumberUpAndRunningWithIronRuby_8C7C/image_thumb_1.png" width="596" border="0" height="145"&gt;
&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
That’s it.&amp;nbsp; You now have Cucumber running with IronRuby.&amp;nbsp; Why is this helpful?&amp;nbsp;
Stay Tuned!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=a04ed319-0b9c-4652-965f-e5991e9a7418" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,a04ed319-0b9c-4652-965f-e5991e9a7418.aspx</comments>
      <category>BDD</category>
      <category>Code</category>
      <category>Cucumber</category>
      <category>IronRuby</category>
      <category>Ruby</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=db0986fa-8e48-4d95-a548-d14cb6c4a94f</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,db0986fa-8e48-4d95-a548-d14cb6c4a94f.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,db0986fa-8e48-4d95-a548-d14cb6c4a94f.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=db0986fa-8e48-4d95-a548-d14cb6c4a94f</wfw:commentRss>
      <title>Requiring Log-On in a WPF MVVM Composite Application</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,db0986fa-8e48-4d95-a548-d14cb6c4a94f.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/08/09/RequiringLogOnInAWPFMVVMCompositeApplication.aspx</link>
      <pubDate>Mon, 09 Aug 2010 21:02:00 GMT</pubDate>
      <description>&lt;p&gt;
Note: This expands on the code created in my previous post: &lt;a href="http://DotNetDevDude.com/Blog/2010/07/30/ImplementingAttributeBasedDomainValidationInAWPFMVVMApplication.aspx"&gt;Implementing
Attribute Based Domain Validation In a WPF MVVM Application&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=b543680f-fc88-45b4-8691-f5751a1c3c7f&amp;amp;url=http%3a%2f%2fwww.DotNetDevDude.com%2fDownloads%2fCode%2fCompositeAppPocWithLogOn.zip"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Continuing on my WPF MVVM Adventures...&lt;/strong&gt; My next task was to implement
security on my composite application.&amp;nbsp; Unfortunately, as is all to often the
case, there where still business decisions to be made concerning the granularity of
the security {is field level required} and also the source of record {LDAP, roll-our-own}.&amp;nbsp;
Not wanting to loose focus on the security piece and knowing I couldn’t sit around
and do nothing I decided to tackle the one piece I knew that was constant…I was going
to need a UI for logging in a user.
&lt;/p&gt;
&lt;p&gt;
I started this process by creating a simple/standard log on window.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/RequiringLogOninaWPFMVVMCompositeApplica_6C50/image_4.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/RequiringLogOninaWPFMVVMCompositeApplica_6C50/image_thumb_1.png" width="244" border="0" height="134"&gt;&lt;/a&gt;&amp;nbsp; &lt;a href="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/RequiringLogOninaWPFMVVMCompositeApplica_6C50/image_10.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="image" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/RequiringLogOninaWPFMVVMCompositeApplica_6C50/image_thumb_4.png" width="244" border="0" height="134"&gt;&lt;/a&gt;&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding: 0px; margin: 0px; display: inline; float: none;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:cb35173f-8e27-4d7b-a839-f425ee69e0c4" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: 1px solid rgb(0, 0, 128); color: rgb(0, 0, 0); font-family: 'Courier New',Courier,Monospace; font-size: 10pt;"&gt;
&lt;div style="background: none repeat scroll 0% 0% rgb(0, 0, 128); color: rgb(255, 255, 255); font-family: Verdana,Tahoma,Arial,sans-serif; font-weight: bold; padding: 2px 5px;"&gt;LogOn.xaml
&lt;/div&gt;
&lt;div style="background: none repeat scroll 0% 0% rgb(221, 221, 221); overflow: auto;"&gt;
&lt;ol style="background: none repeat scroll 0% 0% rgb(0, 0, 0); margin: 0pt 0pt 0pt 2.5em; padding: 0pt 0pt 0pt 5px; white-space: nowrap;"&gt;
&lt;li&gt;
&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Window&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; x&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;Class&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"CompositeAppPoc.Shell.LogOn"&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; xmlns&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"http://schemas.microsoft.com/winfx/2006/xaml/presentation"&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; xmlns&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;x&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"http://schemas.microsoft.com/winfx/2006/xaml"&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Title&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Log
On"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; SizeToContent&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"WidthAndHeight"&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; WindowStartupLocation&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"CenterScreen"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; WindowStyle&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"None"&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; ResizeMode&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"NoResize"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; MinWidth&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"300"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; BorderThickness&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"4"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; AllowsTransparency&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"True"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; TargetType&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"TextBox"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Setter&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Property&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Margin"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Value&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"4"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Setter&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Property&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"MinWidth"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Value&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"100"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; TargetType&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"PasswordBox"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Setter&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Property&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Margin"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Value&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"4"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Setter&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Property&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"MinWidth"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Value&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"100"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; TargetType&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Button"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Setter&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Property&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Margin"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Value&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"4"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Setter&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Property&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"MinWidth"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Value&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"75"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Style&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Window.Resources&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Grid&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ColumnDefinition&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Width&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Auto"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ColumnDefinition&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Grid.ColumnDefinitions&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;RowDefinition&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Height&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Auto"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;RowDefinition&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Height&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Auto"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;RowDefinition&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Height&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Auto"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;RowDefinition&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Height&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Auto"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;RowDefinition&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Grid.RowDefinitions&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(140, 255, 140);"&gt;&amp;lt;!--
Header --&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;StackPanel&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Column&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"0"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Row&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"0"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"2"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Label&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Stretch"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; HorizontalContentAlignment&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Center"&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; FontWeight&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Bold"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; FontSize&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"16"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Content&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Log
On"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Label&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;StackPanel&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(140, 255, 140);"&gt;&amp;lt;!--
Main Controls --&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Label&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Column&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"0"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Row&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"1"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Right"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Content&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"User
Name"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;TextBox&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Column&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"1"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Row&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"1"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; GotFocus&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"CredentialsFocussed"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; x&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;Name&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"txtUsername"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Label&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Column&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"0"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Row&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"2"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Right"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Content&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Password"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;PasswordBox&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Column&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"1"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Row&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"2"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; GotFocus&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"CredentialsFocussed"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; x&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;:&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;Name&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"txtPassword"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt; /&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Label&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Column&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"0"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Row&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"3"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"2"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Center"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Foreground&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Red"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; FontStyle&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Italic"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Visibility&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;="{&lt;/span&gt;&lt;span style="color: rgb(163, 21, 21);"&gt;Binding&lt;/span&gt;&lt;span style="color: rgb(255, 0, 0);"&gt; ShowInvalidCredentials}&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Content&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"*Invalid
User Name and/or Password"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;StackPanel&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Column&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"0"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.Row&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"4"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Grid.ColumnSpan&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"2"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Orientation&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Horizontal"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; VerticalAlignment&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Bottom"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Margin&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"5"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; HorizontalAlignment&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Right"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Height&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Auto"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Button&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Content&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Log-on"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Click&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"LogonClick"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; IsDefault&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"True"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Button&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; Content&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"Cancel"&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt; IsCancel&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(88, 255, 47);"&gt;"True"&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;/&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;StackPanel&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(255, 50, 100);"&gt;&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Grid&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Window&lt;/span&gt;&lt;span style="color: rgb(255, 214, 47);"&gt;&amp;gt;&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding: 0px; margin: 0px; display: inline; float: none;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:4809e62b-395b-42ae-b118-7a7a9bc0b5ea" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: 1px solid rgb(0, 0, 128); color: rgb(0, 0, 0); font-family: 'Courier New',Courier,Monospace; font-size: 10pt;"&gt;
&lt;div style="background: none repeat scroll 0% 0% rgb(0, 0, 128); color: rgb(255, 255, 255); font-family: Verdana,Tahoma,Arial,sans-serif; font-weight: bold; padding: 2px 5px;"&gt;LogOn.xaml.cs
&lt;/div&gt;
&lt;div style="background: none repeat scroll 0% 0% rgb(221, 221, 221); overflow: auto;"&gt;
&lt;ol style="background: none repeat scroll 0% 0% rgb(0, 0, 0); margin: 0pt 0pt 0pt 2.5em; padding: 0pt 0pt 0pt 5px; white-space: nowrap;"&gt;
&lt;li&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;System&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ComponentModel&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;System&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Windows&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;System&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Windows&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Controls&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;System&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Windows&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Controls&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Primitives&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;namespace&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Shell&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;partial&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;LogOn&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; : &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;Window&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;INotifyPropertyChanged&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#region&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; Private
Fields&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#region&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; Public
Properties&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;get&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; { &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;set&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; (&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;value&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;value&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;OnPropertyChanged&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 50, 100);"&gt;"Attempts"&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;Visibility&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ShowInvalidCredentials&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;get&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; { &lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; (&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 74, 255);"&gt;0&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;Visibility&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Visible&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;Visibility&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Hidden&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;UserName&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;get&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; { &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;txtUsername&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Text&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Password&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;get&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; { &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;return&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;txtPassword&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Password&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;LogOn&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;()
: &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Empty&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Empty&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;LogOn&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;userName&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;password&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;InitializeComponent&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;DataContext&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;txtUsername&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Focus&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;txtUsername&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Text&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;userName&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;txtPassword&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Password&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;password&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#region&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; INotifyPropertyChanged
Members&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;event&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;PropertyChangedEventHandler&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;PropertyChanged&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;add&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; { &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;PropertyChangedEvent&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;+=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;value&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;remove&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; { &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;PropertyChangedEvent&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;-=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;value&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;
}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;LogonClick&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;object&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;sender&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;RoutedEventArgs&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;e&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;DialogResult&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;true&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Close&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;CredentialsFocussed&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;object&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;sender&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;RoutedEventArgs&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;e&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;TextBoxBase&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;tb&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;sender&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;as&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;TextBoxBase&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; (&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;tb&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;==&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;PasswordBox&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;pwb&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;sender&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;as&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;PasswordBox&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;pwb&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;SelectAll&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;else&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;tb&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;SelectAll&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;event&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;PropertyChangedEventHandler&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;PropertyChangedEvent&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;protected&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;OnPropertyChanged&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;prop&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; (&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;PropertyChangedEvent&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;!=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;PropertyChangedEvent&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;this&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;PropertyChangedEventArgs&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;prop&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;));&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Now I have my Log On window but it doesn’t do anything.&amp;nbsp; I need to tell my application
to show that window first.&amp;nbsp; Your first thought would be to go into the project
properties and set LogOn as the startup object, but once you got in there you would
notice that there is currently no startup object defined and this is by design.&amp;nbsp;
Currently, because we are working with a composite application, all of that is handles
by our Bootstrapper which is kicked off from App.xaml in the OnStartUp event.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;div style="padding: 0px; margin: 0px; display: inline; float: none;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:c9bbf62a-e61d-45c1-889b-7d1aac13c9ab" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: 1px solid rgb(0, 0, 128); color: rgb(0, 0, 0); font-family: 'Courier New',Courier,Monospace; font-size: 10pt;"&gt;
&lt;div style="background: none repeat scroll 0% 0% rgb(0, 0, 128); color: rgb(255, 255, 255); font-family: Verdana,Tahoma,Arial,sans-serif; font-weight: bold; padding: 2px 5px;"&gt;App.xaml.cs
(Old)
&lt;/div&gt;
&lt;div style="background: none repeat scroll 0% 0% rgb(221, 221, 221); overflow: auto;"&gt;
&lt;ol style="background: none repeat scroll 0% 0% rgb(0, 0, 0); margin: 0pt 0pt 0pt 2.5em; padding: 0pt 0pt 0pt 5px; white-space: nowrap;"&gt;
&lt;li&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;System&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Windows&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;namespace&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Shell&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;partial&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;App&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; : &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Application&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;protected&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;override&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;OnStartup&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;StartupEventArgs&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;e&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;base&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;OnStartup&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;e&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Bootstrapper&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;()&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Run&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
We need to modify App.xaml.cs to:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Show LogOn dialog 
&lt;/li&gt;
&lt;li&gt;
Process result from LogOn dialog 
&lt;/li&gt;
&lt;ol type="I"&gt;
&lt;li&gt;
If ‘Cancel’ is clicked then close the application 
&lt;/li&gt;
&lt;li&gt;
If ‘OK’ is clicked 
&lt;/li&gt;
&lt;ol type="i"&gt;
&lt;li&gt;
Perform authorization 
&lt;/li&gt;
&lt;ol type="a"&gt;
&lt;li&gt;
If authorized&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;
Run the bootstrapper&lt;/li&gt;
&lt;/ol&gt;
&lt;li&gt;
If not authorized&lt;/li&gt;
&lt;ol&gt;
&lt;li&gt;
If exceeded the number of allowed attempts close the application 
&lt;/li&gt;
&lt;li&gt;
Else…add 1 to the attempts, store username and password, and re-show the LogOn&lt;/li&gt;
&lt;/ol&gt;
&gt;
&gt;
&gt;
&gt;
&lt;div style="padding: 0px; margin: 0px; display: inline; float: none;" id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:13f4432a-dc67-4961-8174-2f49326affae" class="wlWriterEditableSmartContent"&gt;
&lt;div style="border: 1px solid rgb(0, 0, 128); color: rgb(0, 0, 0); font-family: 'Courier New',Courier,Monospace; font-size: 10pt;"&gt;
&lt;div style="background: none repeat scroll 0% 0% rgb(0, 0, 128); color: rgb(255, 255, 255); font-family: Verdana,Tahoma,Arial,sans-serif; font-weight: bold; padding: 2px 5px;"&gt;App.xaml.cs
(New)
&lt;/div&gt;
&lt;div style="background: none repeat scroll 0% 0% rgb(221, 221, 221); overflow: auto;"&gt;
&lt;ol style="background: none repeat scroll 0% 0% rgb(0, 0, 0); margin: 0pt 0pt 0pt 2.5em; padding: 0pt 0pt 0pt 5px; white-space: nowrap;"&gt;
&lt;li&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;System&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Collections&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Generic&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;System&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Windows&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Infrastructure&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Entities&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;using&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Infrastructure&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Services&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&lt;span style="color: rgb(94, 187, 215);"&gt;namespace&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;CompositeAppPoc&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Shell&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;partial&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;App&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; : &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;Application&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#region&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; Private
Fields&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;readonly&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;AuthenticationService&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_authenticationService&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;AuthenticationService&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;int&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_userName&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 50, 100);"&gt;""&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_pass&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 50, 100);"&gt;""&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#region&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; Private
Methods&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ShowLogOn&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;var&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;logon&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;LogOn&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_userName&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;,&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_pass&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;logon&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;bool&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;?&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;res&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;logon&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ShowDialog&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; (&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;!&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;res&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;??&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;true&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Shutdown&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 74, 255);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;else&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;AuthenticationContext&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ac&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_authenticationService&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Authenticate&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;logon&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;UserName&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;logon&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Password&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; (&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ac&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;IsAuthorized&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;StartUp&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ac&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;AllowedModules&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;else&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;if&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; (&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;logon&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 74, 255);"&gt;2&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;MessageBox&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Show&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 50, 100);"&gt;"Application
is exiting due to invalid credentials"&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(255, 50, 100);"&gt;"Application
Exit"&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;MessageBoxButton&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;OK&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;, &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;MessageBoxImage&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Error&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Shutdown&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(255, 74, 255);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;else&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; {&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_attempts&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;+=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 74, 255);"&gt;1&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_userName&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;logon&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;UserName&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;_pass&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;logon&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Password&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ShowLogOn&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;private&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;static&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;void&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;StartUp&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;IList&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;string&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;&amp;gt;&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;allowedModules&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;)
{&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Current&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;MainWindow&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;null&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Current&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ShutdownMode&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;ShutdownMode&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;OnMainWindowClose&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;var&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;bs&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;new&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;Bootstrapper&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;bs&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Run&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;bs&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;LoadSecuredModules&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;(&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;allowedModules&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;);&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#region&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; Public
Methods&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(94, 187, 215);"&gt;public&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;App&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;()
{&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;Current&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ShutdownMode&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;=&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt; &lt;/span&gt;&lt;span style="color: rgb(2, 232, 54);"&gt;ShutdownMode&lt;/span&gt;&lt;span style="color: rgb(255, 255, 0);"&gt;.&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;OnExplicitShutdown&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;;&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;&lt;/span&gt;&lt;span style="color: rgb(221, 221, 221);"&gt;ShowLogOn&lt;/span&gt;&lt;span style="color: rgb(240, 120, 0);"&gt;();&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(94, 187, 215);"&gt;#endregion&lt;/span&gt;
&lt;/li&gt;
&lt;li&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;li style="background: none repeat scroll 0% 0% rgb(12, 12, 12);"&gt;
&lt;span style="color: rgb(240, 120, 0);"&gt;}&lt;/span&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
That’s it, now we are requiring logging in to our application.&amp;nbsp; You may notice
that there are bits in there that we haven’t covered yet, AuthenticationContext etc.,
this was me planning for the actual authentication implementation and can be replaced
with whatever code you need.
&lt;/p&gt;
&lt;p&gt;
Stay tuned for the actual security implementation.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/ct.ashx?id=b543680f-fc88-45b4-8691-f5751a1c3c7f&amp;amp;url=http%3a%2f%2fwww.DotNetDevDude.com%2fDownloads%2fCode%2fCompositeAppPocWithLogOn.zip"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=db0986fa-8e48-4d95-a548-d14cb6c4a94f" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,db0986fa-8e48-4d95-a548-d14cb6c4a94f.aspx</comments>
      <category>Code</category>
      <category>Composite Apps</category>
      <category>MVVM</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=b543680f-fc88-45b4-8691-f5751a1c3c7f</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,b543680f-fc88-45b4-8691-f5751a1c3c7f.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,b543680f-fc88-45b4-8691-f5751a1c3c7f.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b543680f-fc88-45b4-8691-f5751a1c3c7f</wfw:commentRss>
      <slash:comments>15</slash:comments>
      <title>Implementing Attribute Based Domain Validation In a WPF MVVM Application</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,b543680f-fc88-45b4-8691-f5751a1c3c7f.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/07/30/ImplementingAttributeBasedDomainValidationInAWPFMVVMApplication.aspx</link>
      <pubDate>Fri, 30 Jul 2010 04:00:00 GMT</pubDate>
      <description>&lt;p&gt;
Note: This expands on the code created in my previous post: &lt;a href="http://DotNetDevDude.com/Blog/2010/07/27/WPFMVVMMultiSolutionCompositeApp.aspx"&gt;WPF
MVVM Multi-Solution Composite App&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/ImplementingAttributeBasedDomainValidati_DCC8/image_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="image" border="0" alt="image" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/ImplementingAttributeBasedDomainValidati_DCC8/image_thumb.png" width="552" height="356"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.DotNetDevDude.com/Downloads/Code/CompositeAppPocWithValidation.zip" target="_blank"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;Continuing on my WPF MVVM Adventures... &lt;/strong&gt;My next task was to architect
and code a validation framework that would:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Adhere to the &lt;a href="http://en.wikipedia.org/wiki/Don't_repeat_yourself" target="_blank"&gt;DRY&lt;/a&gt; principle. 
&lt;li&gt;
Allow me to define all validation in my domain objects. 
&lt;li&gt;
Allow me to easily relay validation issues to the UI/users. 
&lt;li&gt;
Allow me to easily add/modify validation rules. 
&lt;li&gt;
Not be *too* complex :)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Not wanting to re-invent the wheel I did some Googling, on Bing of course.&amp;nbsp; The
first post that caught my eye was by &lt;a href="http://karlshifflett.wordpress.com/mvvm/input-validation-ui-exceptions-model-validation-errors/" target="_blank"&gt;Karl
Shifflett&lt;/a&gt;, whom to me is one of the Grandfathers of WPF, and despite being a VB
guy, usually has the answer.&amp;nbsp; So I read Karl’s article, downloaded the code and
did some investigating.&amp;nbsp; The code would get the job done, but it wasn’t DRY.&amp;nbsp;
Basically every field that was required had a check for not null and not empty, all
validation code was done in the IDataErrorInfo’s Item override,&amp;nbsp; and even Karl
himself recommends not doing it this way, and that you should use &lt;a href="http://karlshifflett.wordpress.com/ocean/" target="_blank"&gt;Ocean&lt;/a&gt; or
another validation framework.&amp;nbsp; Not to discredit Karl, and I certainly recommend
reading not only this post but all of Karl’s posts, but this didn’t fill all of my
requirements.&amp;nbsp; Also, I am the type of developer who won’t use a framework for
something I can code myself with out too much effort.
&lt;/p&gt;
&lt;p&gt;
The next post that looked promising was by &lt;a href="http://joshsmithonwpf.wordpress.com/2008/11/14/using-a-viewmodel-to-provide-meaningful-validation-error-messages/" target="_blank"&gt;Josh
Smith&lt;/a&gt;, whose &lt;u&gt;&lt;a href="http://stores.lulu.com/joshsmithonwpf" target="_blank"&gt;Advanced
MVVM&lt;/a&gt;&lt;/u&gt; book is a must read for anyone using MVVM.&amp;nbsp; Josh’s approach is nearly
identical to Karl’s in that the base of the validation logic is repeated for every
field.&amp;nbsp; Josh’s example also allows for further validation to be done at the ViewModel
level, and this confuses me a little, in that the domain object itself should be the
*gatekeeper* of valid object state.
&lt;/p&gt;
&lt;p&gt;
So, having read these two posts from two of the more prominent WPF developers, and
not finding what I wanted worried me.&amp;nbsp; Maybe I am totally missing something or
what I want is flawed.&amp;nbsp; But hey, that’s why I blog…if I’m wrong call me out…and
tell me why.
&lt;/p&gt;
&lt;p&gt;
I started throwing some designs and thoughts down on paper and kept coming back to
using attributes on the properties of domain objects.&amp;nbsp; Now, I am by no means
a developer that pushes or even prefers attribute based solutions, but in this case
it seemed to fit.
&lt;/p&gt;
&lt;p&gt;
I knew that I was going to need an Interface or Abstract Base Class that would allow
me to generically process the validators and always know what I was dealing with.&amp;nbsp;
In this case I decided to go with an abstract base class just so I could have it inherit
from Attribute and only require my instances of Validator to inherit a single class.&amp;nbsp;
As you can see below the base class is very simple, it inherits Attribute and declares
an abstract Validate method.&amp;nbsp; The other thing you’ll notice is that I decided
to decorate the base class with the Attribute configuration.&amp;nbsp; This may change
in the future, i.e. in some instances I may want to allow multiple of the same validator…say,
if each is configurable.
&lt;/p&gt;
&lt;pre style="border-bottom: #000000 1px solid; border-left: #000000 1px solid; padding-bottom: 5px; background-color: #ffffff; min-height: 40px; padding-left: 5px; padding-right: 5px; overflow: auto; border-top: #000000 1px solid; border-right: #000000 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property, 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2:      AllowMultiple = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;,
Inherited = &lt;span style="color: #0000ff"&gt;true&lt;/span&gt;)] &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3:  &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ValidatorBase
: Attribute { &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4:      &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;abstract&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Validate(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5:  }&lt;/pre&gt;&lt;/pre&gt;
&lt;p&gt;
Now I need a validator.&amp;nbsp; Let’s start simple with a standard required field validator.&amp;nbsp;
I created my class, made it inherit from ValidatorBase and coded the Validate override.
&lt;/p&gt;
&lt;pre style="border-bottom: #000000 1px solid; border-left: #000000 1px solid; padding-bottom: 5px; background-color: #ffffff; min-height: 40px; padding-left: 5px; padding-right: 5px; overflow: auto; border-top: #000000 1px solid; border-right: #000000 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ValidRequiredField
: ValidatorBase { &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2: 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3:     &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;const&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; _INVALID_REQUIRED_FIELD
= "&lt;span style="color: #8b0000"&gt;Required Field&lt;/span&gt;"; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4: 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5:     &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;override&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Validate(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;)
{ &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  6:         &lt;span style="color: #0000ff"&gt;try&lt;/span&gt; { &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  7:              &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;value&lt;/span&gt; == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; || &lt;span style="color: #0000ff"&gt;string&lt;/span&gt;.IsNullOrEmpty(&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;.ToString())) &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  8:                  &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _INVALID_REQUIRED_FIELD; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  9:         }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 10:         &lt;span style="color: #0000ff"&gt;catch&lt;/span&gt; (NullReferenceException)
{ &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 11:             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _INVALID_REQUIRED_FIELD; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 12:         }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 13:         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 14:     }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 15: }&lt;/pre&gt;&lt;/pre&gt;
&lt;p&gt;
The next step is decorate the properties in the domain entity with any validation
attributes.&amp;nbsp; In this case I am decorating the LastName property with the ValidRequiredField
attribute.
&lt;/p&gt;
&lt;pre style="border-bottom: #000000 1px solid; border-left: #000000 1px solid; padding-bottom: 5px; background-color: #ffffff; min-height: 40px; padding-left: 5px; padding-right: 5px; overflow: auto; border-top: #000000 1px solid; border-right: #000000 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: [ValidRequiredField]
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; LastName
{ &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3:     &lt;span style="color: #0000ff"&gt;get&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _lastName;
} &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4:     &lt;span style="color: #0000ff"&gt;set&lt;/span&gt; { &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5:         &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (_lastName
!= &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;) { &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  6:             _lastName = &lt;span style="color: #0000ff"&gt;value&lt;/span&gt;; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  7:             OnPropertyChanged("&lt;span style="color: #8b0000"&gt;LastName&lt;/span&gt;"); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  8:         }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  9:     }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 10: }&lt;/pre&gt;&lt;/pre&gt;
&lt;p&gt;
OK.&amp;nbsp; Cool.&amp;nbsp; Unfortunately, this by itself does nothing.&amp;nbsp; We have to
kick off the validation and put in the processes that allow the ViewModel and UI to
receive notification of validation issues.&amp;nbsp; We will start this process by creating
an abstract base class that our domain entities will inherit from.&amp;nbsp; This abstract
base class will implement &lt;a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanged.aspx" target="_blank"&gt;INotifyPropertyChanged&lt;/a&gt;,
and &lt;a href="http://msdn.microsoft.com/en-us/library/743swcz7.aspx" target="_blank"&gt;IDataErrorInfo&lt;/a&gt;.&amp;nbsp;
I am sure we are all familiar with INotifyPropertyChanged so I am not going to go
into detail on what needs to be done to implement that interface.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
IDataErrorInfo is what is going to allow us to fire off our validation and communicate
any issues to the ViewModel and UI.&amp;nbsp; First we are going to create a Validate
function that will accept a string parameter that represents the property name.&amp;nbsp;
The function will verity that the passed in property name is valid and that a property
with said name exists on the domain entity.&amp;nbsp; If the property exists, its value
is retrieved.&amp;nbsp; The property is then interrogated for attributes of type ValidatorBase.&amp;nbsp;
If/When one is found the validation logic is performed on that property.&amp;nbsp; A the
validation of the property returns something other than null that means the property
is invalid and a string containing details of the validation issue is returned.&amp;nbsp;
If no validation issue is found on the current attribute then the next attribute is
checked and the process continues until we are out of attributes or a validation issue
is found.
&lt;/p&gt;
&lt;pre style="border-bottom: #000000 1px solid; border-left: #000000 1px solid; padding-bottom: 5px; background-color: #ffffff; min-height: 40px; padding-left: 5px; padding-right: 5px; overflow: auto; border-top: #000000 1px solid; border-right: #000000 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Validate(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; propertyName)
{ &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2:     &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; result
= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3:     PropertyInfo prop = GetType().GetProperty(propertyName);
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4:     &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (prop
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt; &amp;amp;&amp;amp; !prop.Name.Equals("&lt;span style="color: #8b0000"&gt;item&lt;/span&gt;",
StringComparison.InvariantCultureIgnoreCase)) { &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5:         &lt;span style="color: #0000ff"&gt;object&lt;/span&gt; &lt;span style="color: #0000ff"&gt;value&lt;/span&gt; =
prop.GetValue(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  6:         var attributes = (ValidatorBase[])prop.GetCustomAttributes(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(ValidatorBase), &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  7:         &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (ValidatorBase
attribute &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; attributes) { &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  8:             result = attribute.Validate(&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;); &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  9:             &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (result
!= &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;) &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 10:                 &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; result; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 11:             }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 12:             &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; result; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 13:         }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 14:         &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; result; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 15:     }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 16: }&lt;/pre&gt;&lt;/pre&gt;
&lt;p&gt;
Next we will implement the contract for IDataErrorInfo.&amp;nbsp; This contract requires
us to implement two properties, even know WPF only uses one of them.&amp;nbsp; The Item
property is an enumerator for the collection of strings representing errors.&amp;nbsp;
In the getter of this property we will return the results of calling our Validate
function with the supplied property name.&amp;nbsp; This will later be hooked up in a
round about way to the View via the ViewModel.
&lt;/p&gt;
&lt;pre style="border-bottom: #000000 1px solid; border-left: #000000 1px solid; padding-bottom: 5px; background-color: #ffffff; min-height: 40px; padding-left: 5px; padding-right: 5px; overflow: auto; border-top: #000000 1px solid; border-right: #000000 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  1: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;[&lt;span style="color: #0000ff"&gt;string&lt;/span&gt; propertyName]
{ &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  2:     &lt;span style="color: #0000ff"&gt;get&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; Validate(propertyName);
} &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  3: }
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  4: 
&lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  5: &lt;span style="color: #008000"&gt;//Note:
WPF does not use this function.&lt;/span&gt; &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  6: &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; Error
{ &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  7:     &lt;span style="color: #0000ff"&gt;get&lt;/span&gt; { &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;;
} &lt;/pre&gt;&lt;pre style="background-color: #ffffff; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  8: }&lt;/pre&gt;&lt;/pre&gt;
&lt;p&gt;
This completes the plumbing for our validation framework.&amp;nbsp; There are an abundant
number of blogs post on how to consume the IDataErrorInfo details in your views.&amp;nbsp;
Beth Massi has done an excellent one which you can find &lt;a href="http://blogs.msdn.com/b/bethmassi/archive/2008/06/27/displaying-data-validation-messages-in-wpf.aspx" target="_blank"&gt;here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
So, in wrapping up I feel like I have completed a validation framework that satisfies
my goals.&amp;nbsp; Hopefully you will find it adaptable to your situation.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.DotNetDevDude.com/Downloads/Code/CompositeAppPocWithValidation.zip" target="_blank"&gt;*
Download Complete Source Code&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=b543680f-fc88-45b4-8691-f5751a1c3c7f" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,b543680f-fc88-45b4-8691-f5751a1c3c7f.aspx</comments>
      <category>Code</category>
      <category>Composite Apps</category>
      <category>MVVM</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=0376d686-9fff-4ec1-83fe-a10788d9e8c2</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,0376d686-9fff-4ec1-83fe-a10788d9e8c2.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,0376d686-9fff-4ec1-83fe-a10788d9e8c2.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=0376d686-9fff-4ec1-83fe-a10788d9e8c2</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <title>WPF MVVM Multi-Solution Composite App</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,0376d686-9fff-4ec1-83fe-a10788d9e8c2.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2010/07/27/WPFMVVMMultiSolutionCompositeApp.aspx</link>
      <pubDate>Tue, 27 Jul 2010 03:49:00 GMT</pubDate>
      <description>&lt;p&gt;
My current client is looking to combine a series of line of business Access (YIKES)
and Win Forms apps into a composite WPF MVVM solution.&amp;nbsp; I was also brought in
to architect one of the heavy hitter apps that will be a part of the new composite
application.&amp;nbsp; In the initial discussion concerning creating a composite application,
one of the client’s developers presented a proof of concept composite application
using Microsoft’s &lt;a href="http://compositewpf.codeplex.com/" target="_blank"&gt;Prism&lt;/a&gt;.
I voiced my concern about the amount of code said solution would be required to handle
and recommended going with a multi-solution composite rather than a multi-project
composite.
&lt;/p&gt;
&lt;p&gt;
I started researching multi-solution composite applications on the inter-webs and
found very little, virtually no, useful material…and this worried me.&amp;nbsp; I couldn’t
be the first guy to think the multi-solution approach would be preferred for a composite
application that will, when all is said and done, contain hundreds of thousands of
lines of code.&amp;nbsp; Not wanting to lead my client in the direction of the proverbial
unicorn I decided to put together a little proof of concept of my own.
&lt;/p&gt;
&lt;p&gt;
*Disclaimer*&lt;br&gt;
This code is a Proof Of Concept and was developed as such.&amp;nbsp; The overall functionality
of the application is trivial.&amp;nbsp; It is UI centric and does not contain a true
data access layer and it does not contain any unit tests.&amp;nbsp; I know this is horrible
but please understand. :)
&lt;/p&gt;
&lt;p&gt;
The typical WPF composite application is broken down into three major sections.
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Infrastructure (VS Project) 
&lt;ul&gt;
&lt;li&gt;
Commands 
&lt;/li&gt;
&lt;li&gt;
Events 
&lt;/li&gt;
&lt;li&gt;
Domain Entities 
&lt;/li&gt;
&lt;li&gt;
Interfaces&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Shell (VS Project) 
&lt;ul&gt;
&lt;li&gt;
WPF Window that will act as the *shell* of your composite application 
&lt;/li&gt;
&lt;li&gt;
Bootstrapper (we will discuss this later)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;
Modules (1 or more VS Projects) 
&lt;ul&gt;
&lt;li&gt;
WPF user controls that make up the functionality of your application 
&lt;/li&gt;
&lt;li&gt;
Modules should be as self contained as possible with minimal references to Infrastructure 
&lt;/li&gt;
&lt;li&gt;
Each module will contain 
&lt;ul&gt;
&lt;li&gt;
View 
&lt;/li&gt;
&lt;li&gt;
View Model 
&lt;/li&gt;
&lt;li&gt;
Controller (optional)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
The structure for a multi-solution composite application is similar but is broken
out into solutions instead of projects, surprise!
&lt;/p&gt;
&lt;blockquote&gt; 
&lt;p&gt;
&lt;a href="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/WPFMVVMMultiSolutionCompositeApp_E225/Solutions.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="Solutions" alt="Solutions" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/WPFMVVMMultiSolutionCompositeApp_E225/Solutions_thumb.png" width="509" border="0" height="659"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
The code is really straightforward.&amp;nbsp; There a couple of requirements though:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;a href="http://compositewpf.codeplex.com/" target="_blank"&gt;Prism&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;a href="http://unity.codeplex.com/" target="_blank"&gt;Unity&lt;/a&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
I included some UI enhancements, including implementing the &lt;a href="http://avalondock.codeplex.com/" target="_blank"&gt;Avalon
Dock&lt;/a&gt; controls for docking windows.
&lt;/p&gt;
&lt;/blockquote&gt; &lt;blockquote&gt; 
&lt;p&gt;
&lt;a href="http://www.dotnetdevdude.com/downloads/code/compositeapp.zip"&gt;Download Here!!!!!!&lt;/a&gt;
&lt;/p&gt;
&lt;/blockquote&gt;&lt;span&gt;&lt;/span&gt;&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=0376d686-9fff-4ec1-83fe-a10788d9e8c2" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,0376d686-9fff-4ec1-83fe-a10788d9e8c2.aspx</comments>
      <category>Code</category>
      <category>Composite Apps</category>
      <category>DDD</category>
      <category>MVVM</category>
      <category>WPF</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=34fb669a-d1ef-481f-bc1a-efbe1e3ffebf</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,34fb669a-d1ef-481f-bc1a-efbe1e3ffebf.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,34fb669a-d1ef-481f-bc1a-efbe1e3ffebf.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=34fb669a-d1ef-481f-bc1a-efbe1e3ffebf</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <title>Nerd Dinner For The Real World – Part 3 (Implementing the Spark View Engine)</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,34fb669a-d1ef-481f-bc1a-efbe1e3ffebf.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2009/05/30/NerdDinnerForTheRealWorldPart3ImplementingTheSparkViewEngine.aspx</link>
      <pubDate>Sat, 30 May 2009 04:05:00 GMT</pubDate>
      <description>&lt;p&gt;
I have a few issues with the standard ASP.NET MVC view engine.&amp;#160; First off it
is too verbose…you have type too much and in my opinion the views don’t look like
html.&amp;#160; Luckily there are alternatives.&amp;#160; One of the most popular ASP.NET
MVC view engine replacements is &lt;a href="http://www.sparkviewengine.com/" target="_blank"&gt;Spark&lt;/a&gt;.&amp;#160;
Spark is replacement view engine that allows you to type less and makes your Views
much easier to read.&amp;#160; So for part 3 of NerdDinnerAdvanced I am replacing the
built in ASP.NET MVC view engine with Spark.
&lt;/p&gt;
&lt;p&gt;
Replacing the view engine in the NerdDinnerAdvanced project was very straight forward.&amp;#160;
Here are the steps.
&lt;/p&gt;
&lt;ol&gt;
&lt;ol&gt;
&lt;li&gt;
Reference Spark.dll and Spark.Web.MVC.dll in NerdDinnerAdvanced.UI 
&lt;br /&gt;
&lt;img style="border-right-width: 0px; margin: 0px 0px 10px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="Spark" border="0" alt="Spark" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/NerdDinnerForTheReadWorldPart3Implementi_1246E/Spark_1.png" width="220" height="71" /&gt; 
&lt;/li&gt;
&lt;li&gt;
Register Spark as a view engine in Global.asax Application_Start 
&lt;br /&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 0px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 0px" 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: #f4f4f4; 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: #008000"&gt;///
&amp;lt;summary&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; border-right-style: none; background-color: #f4f4f4; 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: #008000"&gt;///
Application Start&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: #008000"&gt;///
&amp;lt;/summary&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; border-right-style: none; background-color: #f4f4f4; 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: #0000ff"&gt;protected&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Application_Start()
{&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;    RegisterRoutes(RouteTable.Routes);&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: #f4f4f4; 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: #008000"&gt;//Wire
Up Spark as our ViewEngine (Step 1)&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;    SparkEngineStarter.RegisterViewEngine();&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: #f4f4f4; 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: #008000"&gt;//Initialize
IoC&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;    InversionOfControlHelper.Initialize();&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: #f4f4f4; 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: #008000"&gt;//Wire
up controller factory&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;    ControllerBuilder.Current.SetControllerFactory(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; IoCControllerFactory());&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: #f4f4f4; 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;/li&gt;
&lt;li&gt;
Add a declaration for the Spark configuration section to the Web.config 
&lt;br /&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 0px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 0px" 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: #f4f4f4; 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;!-- Spark Config Section Declaration (Step 2) --&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: #f4f4f4; 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;section name=&lt;span style="color: #006080"&gt;&amp;quot;spark&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;Spark.Configuration.SparkSectionHandler,
Spark&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Add Spark configuration to the Web.config 
&lt;br /&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 0px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 0px" 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: #f4f4f4; 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;!-- Spark Configuration Section --&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: #f4f4f4; 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;spark&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;    &amp;lt;compilation debug=&lt;span style="color: #006080"&gt;&amp;quot;true&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: #f4f4f4; 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;assemblies&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;        &amp;lt;add assembly=&lt;span style="color: #006080"&gt;&amp;quot;NerdDinnerAdvanced.UI&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: #f4f4f4; 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;add assembly=&lt;span style="color: #006080"&gt;&amp;quot;System.Web.Mvc,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35&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;      &amp;lt;/assemblies&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: #f4f4f4; 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;/compilation&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;    &amp;lt;pages&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: #f4f4f4; 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;namespaces&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;        &amp;lt;add &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;System.Collections.Generic&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: #f4f4f4; 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;add &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;System.Linq&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;        &amp;lt;add &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;System.Web.Mvc&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: #f4f4f4; 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;add &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;System.Web.Mvc.Html&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;        &amp;lt;add &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;System.Web.Mvc.Ajax&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: #f4f4f4; 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;add &lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;NerdDinnerAdvanced.Domain.Models&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;      &amp;lt;/namespaces&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: #f4f4f4; 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;/pages&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: #f4f4f4; 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;use content=&lt;span style="color: #006080"&gt;&amp;quot;MainContent&amp;quot;&lt;/span&gt; /&amp;gt;&lt;/pre&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;/spark&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Create Spark master page 
&lt;p style="padding-top: 0px"&gt;
How master pages are implemented in Spark is very cool.&amp;#160; I am not going to go
into details all the ways you can implement master pages in Spark, but you can check
it out &lt;a href="http://www.sparkviewengine.com/documentation/master-layouts" target="_blank"&gt;here&lt;/a&gt;.&amp;#160;
I am going to use the default behavior in which Spark will look for a file name Application.spark
in either the Views/Layout or Views/Shared folders and will apply that to all the
views in project.&amp;#160; So I no longer have to explicitly tell my view what master
to use. So to setup our master page we need to;
&lt;/p&gt;
&lt;ol type="a"&gt;
&lt;li&gt;
Add a new class file under Views –&amp;gt; Shared and name it Application.spark. 
&lt;/li&gt;
&lt;li&gt;
Copy all the code from Site.master into Application.spark 
&lt;/li&gt;
&lt;li&gt;
Remove the Page directive 
&lt;/li&gt;
&lt;li&gt;
Remove the title content place holder 
&lt;/li&gt;
&lt;li&gt;
Replace the main content place holder with Spark content div 
&lt;br /&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 0px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 0px" 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: #f4f4f4; 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;div id=&lt;span style="color: #006080"&gt;&amp;quot;content&amp;quot;&lt;/span&gt;&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&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;lt;/div&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
Replace all '&amp;lt;%= xxx %&amp;gt;' with '${ xxx }' 
&lt;/li&gt;
&lt;li&gt;
You should end up with… 
&lt;br /&gt;
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 0px 0px 5px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 0px" 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: #f4f4f4; 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;!DOCTYPE html PUBLIC &lt;span style="color: #006080"&gt;&amp;quot;-//W3C//DTD
XHTML 1.0 Transitional//EN&amp;quot;&lt;/span&gt; &lt;span style="color: #006080"&gt;&amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&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: #f4f4f4; 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;html xmlns=&lt;span style="color: #006080"&gt;&amp;quot;http://www.w3.org/1999/xhtml&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;&amp;lt;head runat=&lt;span style="color: #006080"&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: #f4f4f4; 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;title&amp;gt;&amp;lt;/title&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;    &amp;lt;link href=&lt;span style="color: #006080"&gt;&amp;quot;../../Content/Site.css&amp;quot;&lt;/span&gt; rel=&lt;span style="color: #006080"&gt;&amp;quot;stylesheet&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/css&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: #f4f4f4; 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;script src=&lt;span style="color: #006080"&gt;&amp;quot;/Scripts/MicrosoftAjax.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;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; 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;script src=&lt;span style="color: #006080"&gt;&amp;quot;/Scripts/MicrosoftMvcAjax.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;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; border-right-style: none; background-color: #f4f4f4; 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;script src=&lt;span style="color: #006080"&gt;&amp;quot;/Scripts/jQuery-1.3.2.js&amp;quot;&lt;/span&gt; type=&lt;span style="color: #006080"&gt;&amp;quot;text/javascript&amp;quot;&lt;/span&gt;&amp;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; 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;/head&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: #f4f4f4; 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;body&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;    &amp;lt;div &lt;span style="color: #0000ff"&gt;class&lt;/span&gt;=&lt;span style="color: #006080"&gt;&amp;quot;page&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: #f4f4f4; 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: 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;div id=&lt;span style="color: #006080"&gt;&amp;quot;header&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: #f4f4f4; 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;div id=&lt;span style="color: #006080"&gt;&amp;quot;title&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;                &amp;lt;h1&amp;gt;Nerd Dinner For The Real World&amp;lt;/h1&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: #f4f4f4; 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;/div&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;/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: #f4f4f4; 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;div id=&lt;span style="color: #006080"&gt;&amp;quot;logindisplay&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;                &amp;lt;% Html.RenderPartial(&lt;span style="color: #006080"&gt;&amp;quot;LogOnUserControl&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: #f4f4f4; 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;/div&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;            &amp;lt;div id=&lt;span style="color: #006080"&gt;&amp;quot;menucontainer&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: #f4f4f4; 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;ul id=&lt;span style="color: #006080"&gt;&amp;quot;menu&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;                    &amp;lt;li&amp;gt;${ Html.ActionLink(&lt;span style="color: #006080"&gt;&amp;quot;Find
Dinner&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;Dinners&amp;quot;&lt;/span&gt;)}&amp;lt;/li&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: #f4f4f4; 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;li&amp;gt;${ Html.ActionLink(&lt;span style="color: #006080"&gt;&amp;quot;Host
Dinner&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;Create&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;Dinners&amp;quot;&lt;/span&gt;)}&amp;lt;/li&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;                    &amp;lt;li&amp;gt;${ Html.ActionLink(&lt;span style="color: #006080"&gt;&amp;quot;About&amp;quot;&lt;/span&gt;,&lt;span style="color: #006080"&gt;&amp;quot;About&amp;quot;&lt;/span&gt;,&lt;span style="color: #006080"&gt;&amp;quot;Home&amp;quot;&lt;/span&gt;)
}&amp;lt;/li&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: #f4f4f4; 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;/ul&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;            &amp;lt;/div&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: #f4f4f4; 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;/div&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;&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: #f4f4f4; 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;div id=&lt;span style="color: #006080"&gt;&amp;quot;main&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;            &amp;lt;div id=&lt;span style="color: #006080"&gt;&amp;quot;content&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: #f4f4f4; 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;use content=&lt;span style="color: #006080"&gt;&amp;quot;MainContent&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;            &amp;lt;/div&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: #f4f4f4; 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;div id=&lt;span style="color: #006080"&gt;&amp;quot;footer&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;            &amp;lt;/div&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: #f4f4f4; 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;/div&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;    &amp;lt;/div&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: #f4f4f4; 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;/body&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;&amp;lt;/html&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
Convert our first page.&amp;#160; Home/Index.aspx 
&lt;ol&gt;
&lt;li&gt;
Rename Index.aspx to Index.spark 
&lt;/li&gt;
&lt;li&gt;
Remove Page directive 
&lt;/li&gt;
&lt;li&gt;
Remove Title content 
&lt;/li&gt;
&lt;li&gt;
Replace ASP main content tag with Spark main content tag 
&lt;/li&gt;
&lt;li&gt;
Replace all '&amp;lt;%= xxx %&amp;gt;' with '${ xxx }' 
&lt;/li&gt;
&lt;/ol&gt;
&lt;/li&gt;
&lt;li&gt;
Now we ran it!&amp;#160; What to notice here is first of all it runs.&amp;#160; The second
thing to notice is the really cool part.&amp;#160; We are seeing a view created using
the Spark View Engine but we are displaying a partial view created using the standard
ASP.NET MVC View Engine.&amp;#160; The Log In/Out user control is still being rendered
by the default view engine. 
&lt;/li&gt;
&lt;li&gt;
Now we are ready to convert the remaining pages.&amp;#160; One difference from the built
in view engine is how you tell the view about the model.&amp;#160; You need to explicitly
specify what model the view uses. 
&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 0px 0px 5px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" 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: #f4f4f4; 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;viewdata model=&lt;span style="color: #006080"&gt;&amp;quot;NerdDinnerAdvanced.UI.Utility.PaginatedCollection&amp;lt;NerdDinnerAdvanced.Domain.Models.Dinner&amp;gt;&amp;quot;&lt;/span&gt;/&amp;gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;
&gt;
&lt;p&gt;
&lt;br /&gt;
The complete code can be downloaded &lt;a href="http://www.dotnetdevdude.com/Downloads/Code/NerdDinnerAdvanced(Part3).zip" target="_blank"&gt;here&lt;/a&gt;.&amp;#160;
Stay tuned for part 4. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=34fb669a-d1ef-481f-bc1a-efbe1e3ffebf" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,34fb669a-d1ef-481f-bc1a-efbe1e3ffebf.aspx</comments>
      <category>Code</category>
      <category>MVC</category>
      <category>NerdDinner</category>
      <category>NerdDinnerAdvanced</category>
      <category>Spark</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=93d7e473-d95a-4ded-a8ac-f0b037089897</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,93d7e473-d95a-4ded-a8ac-f0b037089897.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,93d7e473-d95a-4ded-a8ac-f0b037089897.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=93d7e473-d95a-4ded-a8ac-f0b037089897</wfw:commentRss>
      <slash:comments>12</slash:comments>
      <title>Nerd Dinner For The Real World – Part 2 (NHibernate DAL)</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,93d7e473-d95a-4ded-a8ac-f0b037089897.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2009/05/27/NerdDinnerForTheRealWorldPart2NHibernateDAL.aspx</link>
      <pubDate>Wed, 27 May 2009 13:52:17 GMT</pubDate>
      <description>&lt;p&gt;
In part 2 of the NerdDinnerAdvanced code I replaced the LinqToSql DAL with a DAL that
uses &lt;a href="https://www.hibernate.org" target="_blank"&gt;NHibernate&lt;/a&gt;.&amp;nbsp; NHibernate
is an open sourced object relational mapper.&amp;nbsp; If you are not familiar with ORM
and/or NHibernate I highly suggest you check them out.&amp;nbsp; Because of the way we
architected our project in Part 1 implementing an NHibernate DAL had little to no
impact on any code above the DAL.
&lt;/p&gt;
&lt;p&gt;
To start I re-structured the project a little.&amp;nbsp; I created a NerdDinnerAdvanced.Data.LinqToSql
project and moved the LinqToSql DinnerRepository and the NerdDinner.dbml file into
the new project.&amp;nbsp; This left just the IDinnerRepository in the NerdDinnerAdvanced.Data
project.&amp;nbsp; You could certainly move the IDinnerRepository class to the NerdDinnerAdvanced.Common
project and remove the NerdDinnerAdvanced.Data project if you wish.
&lt;/p&gt;
&lt;p&gt;
&lt;img style="border-width: 0px; display: block; float: none; margin-left: auto; margin-right: auto;" title="DataAndLinqToSql" alt="DataAndLinqToSql" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/NerdDinnerForTheRealWorldPart2NHibernate_7091/DataAndLinqToSql_1.png" border="0" height="150" width="243"&gt;
&lt;/p&gt;
&lt;p&gt;
Now it was time to create my NHibernate mappings.&amp;nbsp; If you are not familiar with
how ORM’s work the basic concept is that the ORM framework maps data from a database
to your entity/domain objects In order to accomplish this you need to tell the ORM
what tables/columns map to what objects/fields and this is typically done via an XML
file.&amp;nbsp; In this case we only have 2 objects to map, Dinner and Rsvp, so the mapping
would not be complex.&amp;nbsp; Often, though, you are dealing with hundreds of objects
with a lot of fields and the management of the XML mapping files can get very difficult.&amp;nbsp;
For this reason, and because I wanted to have a chance to play with it, I decided
to use &lt;a href="http://fluentnhibernate.org/" target="_blank"&gt;Fluent NHibernate&lt;/a&gt; to
do my mapping.&amp;nbsp; Fluent NHibernate allows you to do your mappings using strongly
typed C# code.
&lt;/p&gt;
&lt;p&gt;
In my NerdDinnerAdvanced.Domain project I created a new folder called Mappings and
added two mapping classes, one for each of my two domain objects.
&lt;/p&gt;
&lt;p&gt;
&lt;img style="border: 0px none ; display: block; float: none; margin-left: auto; margin-right: auto;" title="Mappings" alt="Mappings" src="http://dotnetdevdude.com/Blog/content/binary/WindowsLiveWriter/NerdDinnerForTheRealWorldPart2NHibernate_7091/Mappings_1.png" border="0" height="117" width="208"&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Because this is not a Fluent NHibernate tutorial I am not going to go into detail
on how you create the mappings…and for the most part it is fairly intuitive.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; ///
&amp;lt;summary&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
Fluent NHibernate mapping for the Dinner class&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; DinnerMap
: ClassMap&amp;lt;Dinner&amp;gt; { &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; DinnerMap()
{ WithTable(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Dinners"&lt;/span&gt;);
SetAttribute(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"lazy"&lt;/span&gt;, &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"false"&lt;/span&gt;);
Id(x =&amp;gt; x.DinnerId); Map(x =&amp;gt; x.Title); Map(x =&amp;gt; x.Description); Map(x =&amp;gt;
x.EventDate); Map(x =&amp;gt; x.HostedBy); Map(x =&amp;gt; x.Address); Map(x =&amp;gt; x.Country);
Map(x =&amp;gt; x.ContactPhone); Map(x =&amp;gt; x.Latitude); Map(x =&amp;gt; x.Longitude); HasMany(x
=&amp;gt; x.Rsvps).Inverse().KeyColumnNames.Add(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"DinnerId"&lt;/span&gt;).Cascade.All().SetAttribute(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"lazy"&lt;/span&gt;, &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"false"&lt;/span&gt;);
} }&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Next it was time to create the NHibernate DAL so I added a NerdDinnerAdvanced.Data.NHibernate
project to the solution.&amp;nbsp; The first thing you have to do when using NHibernate,
after creating your mapping files, is create your NHibernate Session class.&amp;nbsp;
Session to NHibernate is like DataContext to Linq.&amp;nbsp;&amp;nbsp; The Session for the
most part contains connection string and mapping info and it is the mediator between
you and your data.
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; ///
&amp;lt;summary&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
NHibernate session factory&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt; SessionFactory
{ &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;static&lt;/span&gt; ISessionFactory
CreateSessionFactory() { &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005.ConnectionString(c =&amp;gt; c.Is(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Data
Source=keith-166938fd4;Initial Catalog=NerdDinner;Integrated Security=True"&lt;/span&gt;)))
.Mappings(m =&amp;gt; m.FluentMappings.AddFromAssemblyOf&amp;lt;Dinner&amp;gt;()) .BuildSessionFactory();
} }&lt;/span&gt;&lt;/pre&gt;&lt;/blockquote&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
After creating the NHibernate Session class I can now implement my DinnerRepository
using NHibernate.&amp;nbsp; Below is an example of the FindAllDinners method.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
Returns a list of all dinners&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;returns&amp;gt;List of all dinners&amp;lt;/returns&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; IQueryable&amp;lt;Dinner&amp;gt;
FindAllDinners() {&lt;br&gt;
var sessionFactory &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; SessionFactory.CreateSessionFactory();&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;using&lt;/span&gt; (var
session &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; sessionFactory.OpenSession())
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;using&lt;/span&gt; (session.BeginTransaction())
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; session.CreateCriteria(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;typeof&lt;/span&gt;(Dinner)).List&amp;lt;Dinner&amp;gt;().AsQueryable();&lt;br&gt;
}&lt;br&gt;
}&lt;br&gt;
}&lt;/span&gt;
&lt;br&gt;
&lt;/pre&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
After completing the DinnerRepository we can tell our application to use the the new
DAL by changing one line in our InversionOfControlHelper class.
&lt;/p&gt;
&lt;p&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; ///
&amp;lt;summary&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
Initializes the inversion of control mappings&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;static&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; Initialize()
{&lt;br&gt;
StructureMapConfiguration.ResetAll();&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Tell
Structure Map we are using Fluent mapping rather than onfiguration file based mapping!&lt;/span&gt; StructureMapConfiguration.UseDefaultStructureMapConfigFile &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;false&lt;/span&gt;;&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//This
is the only line of code outside of the DAL that needed to be modified to implement
the NHibernate data access layer!&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//StructureMapConfiguration.BuildInstancesOf&amp;lt;IDinnerRepository&amp;gt;().TheDefaultIsConcreteType&amp;lt;Data.LinqToSql.DinnerRepository&amp;gt;();&lt;/span&gt;
&lt;br&gt;
&lt;b&gt; &lt;u&gt;StructureMapConfiguration.BuildInstancesOf&amp;lt;IDinnerRepository&amp;gt;().TheDefaultIsConcreteType&amp;lt;Data.NHibernate.DinnerRepository&amp;gt;();&lt;/u&gt;
&lt;br&gt;
&lt;/b&gt; StructureMapConfiguration.BuildInstancesOf&amp;lt;IDinnerServices&amp;gt;().TheDefaultIsConcreteType&amp;lt;DinnerServices&amp;gt;();&lt;br&gt;
}&lt;/span&gt;&lt;/pre&gt;
&lt;br&gt;
&gt;
&lt;p&gt;
Once again the complete source can be downloaded &lt;a href="http://www.DotNetDevDude.com/Downloads/Code/NerdDinnerAdvanced%28Part2%29.zip"&gt;here&lt;/a&gt;.&amp;nbsp;
Stay tuned for Part 3!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=93d7e473-d95a-4ded-a8ac-f0b037089897" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,93d7e473-d95a-4ded-a8ac-f0b037089897.aspx</comments>
      <category>Code</category>
      <category>MVC</category>
      <category>NerdDinner</category>
      <category>NerdDinnerAdvanced</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=c2f77920-8379-446d-9447-7f425e37d352</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,c2f77920-8379-446d-9447-7f425e37d352.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,c2f77920-8379-446d-9447-7f425e37d352.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=c2f77920-8379-446d-9447-7f425e37d352</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <title>NerdDinner For The Real World – Part 1</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,c2f77920-8379-446d-9447-7f425e37d352.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2009/05/16/NerdDinnerForTheRealWorldPart1.aspx</link>
      <pubDate>Sat, 16 May 2009 21:10:32 GMT</pubDate>
      <description>&lt;p&gt;
The first chapter of &lt;a href="http://www.wrox.com/WileyCDA/WroxTitle/Professional-ASP-NET-MVC-1-0.productCd-0470384611.html"&gt;Professional
ASP.NET MVC 1.0&lt;/a&gt; walks you through creating the basic &lt;a href="http://www.nerddinner.com/"&gt;NerdDinner&lt;/a&gt; site.&amp;nbsp;
This is a great introduction to ASP.NET MVC but really isn’t something you could as
reference for creating a real world ASP.MVC site.&amp;nbsp; With this in mind I set out
on a multi part project to create a real world ASP.NET reference application based
on the base NerdDinner code.
&lt;/p&gt;
&lt;p&gt;
It the first installation of what I am calling NerdDinnerAdvanced I extended the base
NerdDinner code in the following ways;
&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;
Created 3-tier architecture.&amp;nbsp; One of the major misconceptions about ASP.NET MVC
is that it is a UI framework.&amp;nbsp; I think this is mainly due to the fact that the
major changes that developers need to wrap their head around are in the UI.&amp;nbsp;
To help alleviate this misconception I structured the MVC project architecturally
that developers who have experience in n-tier architecture will find familiar. 
&lt;br&gt;
&amp;nbsp;The layers, as you can see highlighted above, are UI, Business, and Data.&amp;nbsp;
Because of the overall simplistic nature of the underlying code I did not include
a Service layer.&amp;nbsp; The other projects are shared by the layers.&amp;nbsp; The Domain
project contains my models and the Common project contains common utility classes. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p align="center"&gt;
&amp;nbsp;&lt;img src="http://www.DotNetDevDude.com/Images/FileStructure.png"&gt;
&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;
The base NerdDinner code used LINQ to SQL and was content with passing the LINQ to
SQL entities between the layers of the application.&amp;nbsp; I would guess that Mr. Gu
did this for simplicity and brevity and not a show of best practice.&amp;nbsp; If you
are asking yourself what is wrong with architecting around LINQ to SQL entities I
would recommend picking up Dino Esposito’s latest &lt;a href="http://www.microsoft.com/learning/en/us/Books/12863.aspx"&gt;book&lt;/a&gt;.&amp;nbsp;
The main reason is that you are tightly coupling yourself to the database.&amp;nbsp; So
in my Domain project I created a Models namespace and created Dinner, Rsvp, and DinnerFormView
domain objects. 
&lt;br&gt;
&lt;div align="center"&gt;&lt;a href=""&gt;&lt;img src="http://www.DotNetDevDude.com/Images/DomainObjects.png"&gt;&lt;/a&gt;
&lt;br&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;
&amp;nbsp; Implemented &lt;a href="http://martinfowler.com/articles/injection.html"&gt;Inversion
Of Control/Dependency Injection&lt;/a&gt; using &lt;a href="http://structuremap.sourceforge.net/Default.htm"&gt;Structure
Map&lt;/a&gt;.&amp;nbsp; The base NerdDinner code used manual IoC/Di in the DinnersController
but I decided to take that a step further because I am on a bit of an Ioc/Di fix lately.&amp;nbsp;
I implemented it on the repository and the dinner services business object as well
as the Dinner and Rsvp controllers. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;ul&gt;
&lt;ul&gt;
&lt;li&gt;
Implemented a full suite of unit testing using &lt;a href="http://code.google.com/p/moq/"&gt;MOQ&lt;/a&gt; for
mocking objects. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;br&gt;
&lt;blockquote&gt;The code can be downloaded &lt;a href="http://www.DotNetDevDude.com/Downloads/Code/NerdDinnerAdvanced%28Part1%29.zip"&gt;here&lt;/a&gt;.&amp;nbsp;
Stay tuned for the next installment which will include nHibernate as the DAL.&lt;br&gt;
&lt;/blockquote&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=c2f77920-8379-446d-9447-7f425e37d352" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,c2f77920-8379-446d-9447-7f425e37d352.aspx</comments>
      <category>Code</category>
      <category>MVC</category>
      <category>NerdDinner</category>
      <category>NerdDinnerAdvanced</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=550fa0a3-f3b1-4a6f-9475-1c3f778f4d37</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,550fa0a3-f3b1-4a6f-9475-1c3f778f4d37.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,550fa0a3-f3b1-4a6f-9475-1c3f778f4d37.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=550fa0a3-f3b1-4a6f-9475-1c3f778f4d37</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <title>ASP.NET MVC 1.0 – Nerd Dinner with Cliff Notes</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,550fa0a3-f3b1-4a6f-9475-1c3f778f4d37.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2009/05/13/ASPNETMVC10NerdDinnerWithCliffNotes.aspx</link>
      <pubDate>Wed, 13 May 2009 22:17:26 GMT</pubDate>
      <description>&lt;link rel="File-List" href="file:///C:%5CUsers%5Ckburnell%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;
&lt;link rel="themeData" href="file:///C:%5CUsers%5Ckburnell%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;
&lt;link rel="colorSchemeMapping" href="file:///C:%5CUsers%5Ckburnell%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val="Cambria Math"/&gt;
   &lt;m:brkBin m:val="before"/&gt;
   &lt;m:brkBinSub m:val="&amp;#45;-"/&gt;
   &lt;m:smallFrac m:val="off"/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val="0"/&gt;
   &lt;m:rMargin m:val="0"/&gt;
   &lt;m:defJc m:val="centerGroup"/&gt;
   &lt;m:wrapIndent m:val="1440"/&gt;
   &lt;m:intLim m:val="subSup"/&gt;
   &lt;m:naryLim m:val="undOvr"/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267"&gt;
  &lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/&gt;
  &lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/&gt;
  &lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/&gt;
  &lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/&gt;
  &lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/&gt;
  &lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/&gt;
  &lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="37" Name="Bibliography"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:1;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:variable;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-520092929 1073786111 9 0 415 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin-top:0in;
	mso-para-margin-right:0in;
	mso-para-margin-bottom:10.0pt;
	mso-para-margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
&lt;/style&gt;
&lt;![endif]--&gt;
&lt;p class="MsoNormal"&gt;
I recently finished reading the first chapter of &lt;a href="http://www.wrox.com/WileyCDA/WroxTitle/Professional-ASP-NET-MVC-1-0.productCd-0470384611.html"&gt;ASP.NET
MVC 1.0&lt;/a&gt;, which&lt;span style=""&gt;&lt;/span&gt; deals strictly with the &lt;a href="http://www.nerddinner.com/"&gt;Nerd
Dinner&lt;/a&gt; site that 3 of the 4 authors of the book put together.&amp;nbsp; This book
has been a delight to read to this point and I highly recommend it.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;In
reading the first chapter I wrote&amp;nbsp; the code along with the book.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;I
wanted to make the code a source of reference for me in the future so while I was
coding I added comments detailing points of interest from the book.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;Along
the way I thought making it available to the masses might be a good idea.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;Since
I wasn't sure on the legal ramifications of putting exact text from a book into my
code comments I contacted one of the authors.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;I received
an email from said author a day later and he stated, and I quote “I say blog first,
ask permission later.”&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;So that is exactly what I am doing.&amp;nbsp;
You can download the full source &lt;a href="http://www.dotnetdevdude.com/downloads/code/NerdDinner.zip"&gt;here&lt;/a&gt;.
Below is a sample...
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
Attempts to perform an edit on the Dinner with the provided id using the provided
formValues&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
URL : /Dinners/Edit/[id]&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
Verb : Post&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
Purpose : Save the form changes for a particular Dinner to the database&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;/summary&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;param name="id"&amp;gt;Id of dinner to edit&amp;lt;/param&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;param name="formValues"&amp;gt;Incoming form parameters&amp;lt;/param&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;returns&amp;gt;Details for view for the dinner that was edited&amp;lt;/returns&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;remarks&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
The "AcceptVerbs" attribute indicates it handles HTTP Post scenarios.&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
When the attribute is applied to overloaded action methods ASP.NET MVC&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
automatically handles dispatching to the appropriate action method depending&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
on the incoming HTTP verb.&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
For details on why MVC differentiates via HTTP verbs and doesn't use the &lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
multiple URL approach see page 64.&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;/remarks&amp;gt;&lt;/span&gt; [AcceptVerbs(HttpVerbs.Post)] &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; ActionResult
Edit(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;int&lt;/span&gt; id,
FormCollection formValues) { &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Call
method on our DinnerRepository to get the Dinner being edited&lt;/span&gt; var dinner &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; _dinnerRepository.GetDinner(id); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Verify
that a dinner was found&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (dinner
== &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;) &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; View(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"NotFound"&lt;/span&gt;); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Verify
that the logged-in user matches the dinner host&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;if&lt;/span&gt; (!dinner.IsHostedBy(User.Identity.Name)) &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; View(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"InvalidOwner"&lt;/span&gt;); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//The
"try" block will catch errors in calling UpdateModel or when we&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//try
and save the DinnerRepository, which will throw if the Dinner object&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//we
are tyring to save is invalid because of a rule violation.&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;try&lt;/span&gt; { &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//The
"UpdateModel" helper method on the Controller base class supports updating&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//the
properties of the object being passed to it using the incoming form parameters.&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//It
uses reflection to determine the property names on the object, and then automatically&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//converts
and assigns values to them based on the input values submitted by the client.&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//The
method will automatically update the "ModelState" collection when it encounters errors&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//while
trying to assign form values to properties on the model object. For example putting &lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//something
other than a DateTime in the EventDate field.&lt;/span&gt; UpdateModel(dinner); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Persist
the changes&lt;/span&gt; _dinnerRepository.Save(); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Return
the Details view for the dinner being edited&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; RedirectToAction(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Details"&lt;/span&gt;, &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt;{id &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; dinner.DinnerId});
} &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;catch&lt;/span&gt; { &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Handle
edit errors&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//******
The code below was refactored to an extension method in the class ControllerHelpers&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;////Loop
through the rule violations and add to ModelState&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//foreach
(var issue in dinner.GetRuleViolations()){&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
//The "ModelState" property collection provides a way to indicate that&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
//errors exist with a model object being passed to a view. Error entries&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
//within the the "ModelState" collection identify the name of the model &lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
//property with the issue and allow a human-friendly error message to be specified.&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
//HTML helper methods like "HTML.TextBox" check the "ModelState" collection to see &lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
//if there were any errors associated with the property on the model object the control&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
//is associated with. If it determines that there was an error it renders the submitted
user&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
//input as the value and adds a CSS error class to the markup it generates.&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
ModelState.AddModelError(issue.PropertyName, issue.ErrorMessage);&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//}&lt;/span&gt; ModelState.AddRuleViolations(dinner.GetRuleViolations()); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Example
below uses ViewData...which is not strongly-typed&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Add
the SelectList to ViewData so the Countries drop down list is populated when rendered&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//ViewData["countries"]
= new SelectList(PhoneValidator.Countries, dinner.Country);&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Example
using ViewModel which is strongly-typed&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;return&lt;/span&gt; View(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;new&lt;/span&gt; DinnerFormViewModel(dinner)); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Return
the Dinner view&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//return
View(dinner);&lt;/span&gt; } }&lt;br&gt;
&lt;br&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=550fa0a3-f3b1-4a6f-9475-1c3f778f4d37" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,550fa0a3-f3b1-4a6f-9475-1c3f778f4d37.aspx</comments>
      <category>Code</category>
      <category>MVC</category>
      <category>NerdDinner</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=6e4cf928-037b-4fbf-b09c-b35c024051c1</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,6e4cf928-037b-4fbf-b09c-b35c024051c1.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,6e4cf928-037b-4fbf-b09c-b35c024051c1.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=6e4cf928-037b-4fbf-b09c-b35c024051c1</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <title>Mocking with RhinoMocks and Linq to SQL</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,6e4cf928-037b-4fbf-b09c-b35c024051c1.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2009/04/27/MockingWithRhinoMocksAndLinqToSQL.aspx</link>
      <pubDate>Mon, 27 Apr 2009 00:26:34 GMT</pubDate>
      <description>&lt;link rel="File-List" href="file:///C:%5CUsers%5Ckburnell%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;
&lt;link rel="themeData" href="file:///C:%5CUsers%5Ckburnell%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;
&lt;link rel="colorSchemeMapping" href="file:///C:%5CUsers%5Ckburnell%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val="Cambria Math"/&gt;
   &lt;m:brkBin m:val="before"/&gt;
   &lt;m:brkBinSub m:val="&amp;#45;-"/&gt;
   &lt;m:smallFrac m:val="off"/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val="0"/&gt;
   &lt;m:rMargin m:val="0"/&gt;
   &lt;m:defJc m:val="centerGroup"/&gt;
   &lt;m:wrapIndent m:val="1440"/&gt;
   &lt;m:intLim m:val="subSup"/&gt;
   &lt;m:naryLim m:val="undOvr"/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267"&gt;
  &lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/&gt;
  &lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/&gt;
  &lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/&gt;
  &lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/&gt;
  &lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/&gt;
  &lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/&gt;
  &lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="37" Name="Bibliography"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:1;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:variable;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin-top:0in;
	mso-para-margin-right:0in;
	mso-para-margin-bottom:10.0pt;
	mso-para-margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
&lt;link rel="File-List" href="file:///C:%5CUsers%5Ckburnell%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
  &lt;/w:Compatibility&gt;
  &lt;w:BrowserLevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val="Cambria Math"/&gt;
   &lt;m:brkBin m:val="before"/&gt;
   &lt;m:brkBinSub m:val="&amp;#45;-"/&gt;
   &lt;m:smallFrac m:val="off"/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val="0"/&gt;
   &lt;m:rMargin m:val="0"/&gt;
   &lt;m:defJc m:val="centerGroup"/&gt;
   &lt;m:wrapIndent m:val="1440"/&gt;
   &lt;m:intLim m:val="subSup"/&gt;
   &lt;m:naryLim m:val="undOvr"/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267"&gt;
  &lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/&gt;
  &lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/&gt;
  &lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/&gt;
  &lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/&gt;
  &lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/&gt;
  &lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/&gt;
  &lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="37" Name="Bibliography"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:1;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:variable;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;
	line-height:115%;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin-top:0in;
	mso-para-margin-right:0in;
	mso-para-margin-bottom:10.0pt;
	mso-para-margin-left:0in;
	line-height:115%;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;I
figured I was to the point where I was comfortable enough with the concept of mocking
that I would start implementing it in one of the projects I am working on at my current
client.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;The data access layer of the application obtains
data from two sources; a CIS system that is only reachable via web services and a
data warehouse on a SQL Server that we are accessing directly using stored procedures
and LINQ to SQL.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;I started with mocking the web service
piece and that went off without a hitch.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;&lt;span style=""&gt;&lt;/span&gt;&gt;
&lt;p class="MsoNormal" style="margin-bottom: 0.0001pt;"&gt;
The Linq To SQL piece did not go as smoothly.&amp;nbsp; I had a few issues creating the
Interface for the DataContext and then ran into trying to mock System.Data.Linq.Table
which is Sealed.&amp;nbsp; Instead of copying and pasting the code in the post and explaining
it I think that I will let the code speak for itself.&amp;nbsp; If you are like me you
find it much easier to understand complex code in the solution structure offered by
Visual Studio.&amp;nbsp; So grab the code from &lt;a href="http://www.DotNetDevDude.com/Downloads/Code/RhinoMocks.zip"&gt;here &lt;/a&gt;and
dive in.&lt;br&gt;
&lt;/p&gt;
&lt;span style="font-size: 11pt; line-height: 115%; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;/span&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=6e4cf928-037b-4fbf-b09c-b35c024051c1" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,6e4cf928-037b-4fbf-b09c-b35c024051c1.aspx</comments>
      <category>Code</category>
      <category>RhinoMocks</category>
      <category>TDD</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=7788ec8c-67c1-48b4-8a42-1637cd78c688</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,7788ec8c-67c1-48b4-8a42-1637cd78c688.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,7788ec8c-67c1-48b4-8a42-1637cd78c688.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=7788ec8c-67c1-48b4-8a42-1637cd78c688</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <title>Assertions missing from MsTest</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,7788ec8c-67c1-48b4-8a42-1637cd78c688.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2009/04/19/AssertionsMissingFromMsTest.aspx</link>
      <pubDate>Sun, 19 Apr 2009 22:30:22 GMT</pubDate>
      <description>There are a few assertions, other than Exception assertion, that are missing from MsTest.&amp;nbsp; Some of these I missed enough to roll my own are GreaterThan, GreaterThanOrEqualTo, LessThan, and LessThanOrEqualTo.&amp;nbsp; Check the &lt;a href="http://DotNetDevDude.com/Downloads/Code/CustomAssertions.zip"&gt;code&lt;/a&gt; out
to see how I accomplished this.&lt;br&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=7788ec8c-67c1-48b4-8a42-1637cd78c688" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,7788ec8c-67c1-48b4-8a42-1637cd78c688.aspx</comments>
      <category>Code</category>
    </item>
    <item>
      <trackback:ping>http://dotnetdevdude.com/Blog/Trackback.aspx?guid=5ad8bc4b-6ecf-407e-9443-f159eb6342f4</trackback:ping>
      <pingback:server>http://dotnetdevdude.com/Blog/pingback.aspx</pingback:server>
      <pingback:target>http://dotnetdevdude.com/Blog/PermaLink,guid,5ad8bc4b-6ecf-407e-9443-f159eb6342f4.aspx</pingback:target>
      <dc:creator>DotNetDevDude</dc:creator>
      <wfw:comment>http://dotnetdevdude.com/Blog/CommentView,guid,5ad8bc4b-6ecf-407e-9443-f159eb6342f4.aspx</wfw:comment>
      <wfw:commentRss>http://dotnetdevdude.com/Blog/SyndicationService.asmx/GetEntryCommentsRss?guid=5ad8bc4b-6ecf-407e-9443-f159eb6342f4</wfw:commentRss>
      <slash:comments>9</slash:comments>
      <title>Testing for Exceptions with MSTest</title>
      <guid isPermaLink="false">http://dotnetdevdude.com/Blog/PermaLink,guid,5ad8bc4b-6ecf-407e-9443-f159eb6342f4.aspx</guid>
      <link>http://DotNetDevDude.com/Blog/2009/04/03/TestingForExceptionsWithMSTest.aspx</link>
      <pubDate>Fri, 03 Apr 2009 23:51:59 GMT</pubDate>
      <description>&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CKBurnell%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:OfficeDocumentSettings&gt;
  &lt;o:RelyOnVML/&gt;
  &lt;o:AllowPNG/&gt;
 &lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;link rel="themeData" href="file:///C:%5CDOCUME%7E1%5CKBurnell%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;
&lt;link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5CKBurnell%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
  &lt;/w:Compatibility&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val="Cambria Math"/&gt;
   &lt;m:brkBin m:val="before"/&gt;
   &lt;m:brkBinSub m:val="&amp;#45;-"/&gt;
   &lt;m:smallFrac m:val="off"/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val="0"/&gt;
   &lt;m:rMargin m:val="0"/&gt;
   &lt;m:defJc m:val="centerGroup"/&gt;
   &lt;m:wrapIndent m:val="1440"/&gt;
   &lt;m:intLim m:val="subSup"/&gt;
   &lt;m:naryLim m:val="undOvr"/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267"&gt;
  &lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/&gt;
  &lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/&gt;
  &lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/&gt;
  &lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/&gt;
  &lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/&gt;
  &lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/&gt;
  &lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="37" Name="Bibliography"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:1;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:variable;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin-top:0in;
	mso-para-margin-right:0in;
	mso-para-margin-bottom:10.0pt;
	mso-para-margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;
&lt;p class="MsoNormal"&gt;
Although the built in unit testing is nice, for us user’s of &lt;a href="http://www.jetbrains.com"&gt;ReSharper &lt;/a&gt;it
is something we have had for awhile with their NUnit integration, it is missing some
things from NUnit that I have come to love, one&lt;span style=""&gt;&lt;/span&gt; of which is
the ability to test expected exceptions.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;MSTest does supply
the ExpectedException attribute which does allow you to test for a single exception,
helpful if all methods you code only throw a single exception each.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;If
your methods are more complicated you have to write a test for each of the exceptions
you expect to encounter.
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;/p&gt;
&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; ///
&amp;lt;summary&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; ///A
test for ATestMethod&lt;/span&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; ///&amp;lt;/summary&amp;gt;&lt;/span&gt; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
[TestMethod] &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [HostType(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"ASP.NET"&lt;/span&gt;)]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [AspNetDevelopmentServerHost(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"%PathToWebRoot%\\Learning\\CustomAssertions\\CustomAssertions\\CustomAssertions"&lt;/span&gt;, &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"/"&lt;/span&gt;)]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [UrlToTest(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"http://localhost:1777/"&lt;/span&gt;)]
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [ExpectedException(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;typeof&lt;/span&gt;(ArgumentNullException))] &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; ATestMethodTest()
{ &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; s &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Test"&lt;/span&gt;; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;int&lt;/span&gt; actual &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; MethodsForTesting.ATestMethod(s); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//This
is a valid, simple but still valid, test of the pass condition.&lt;/span&gt; Assert.AreEqual(1,
actual); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//What
if I want to test the part of my code that throws exceptions?&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//The
only built in solution that MsTest offers is using the "ExpectedException" attribute.&lt;/span&gt; actual &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; MethodsForTesting.ATestMethod(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Because
you can only have one per method it leaves a little something to be desired&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//If
I want to test more than one expected exception I need to have a test for each ExpectedException
after the first&lt;/span&gt; } &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///Another
test for ATestMethod&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///&amp;lt;/summary&amp;gt;&lt;/span&gt; [TestMethod]
[HostType(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"ASP.NET"&lt;/span&gt;)]
[AspNetDevelopmentServerHost(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"%PathToWebRoot%\\Learning\\CustomAssertions\\CustomAssertions\\CustomAssertions"&lt;/span&gt;, &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"/"&lt;/span&gt;)]
[UrlToTest(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"http://localhost:1777/"&lt;/span&gt;)]
[ExpectedException(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;typeof&lt;/span&gt;(InvalidOperationException))] &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; ATestMethodTest2()
{ &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//So
this is the test of my second ExpectedException.&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//If
you are writing one unit test per method plus one for each expected exception&lt;/span&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//your
test suite is going to get of of control before you know it.&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;string&lt;/span&gt; s &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"This
is a long string"&lt;/span&gt;; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;int&lt;/span&gt; actual &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; MethodsForTesting.ATestMethod(s);
} &lt;/span&gt;&lt;/pre&gt;
&lt;div align="left"&gt;
&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CKBurnell%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:OfficeDocumentSettings&gt;
  &lt;o:RelyOnVML/&gt;
  &lt;o:AllowPNG/&gt;
 &lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;link rel="themeData" href="file:///C:%5CDOCUME%7E1%5CKBurnell%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;
&lt;link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5CKBurnell%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
  &lt;/w:Compatibility&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val="Cambria Math"/&gt;
   &lt;m:brkBin m:val="before"/&gt;
   &lt;m:brkBinSub m:val="&amp;#45;-"/&gt;
   &lt;m:smallFrac m:val="off"/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val="0"/&gt;
   &lt;m:rMargin m:val="0"/&gt;
   &lt;m:defJc m:val="centerGroup"/&gt;
   &lt;m:wrapIndent m:val="1440"/&gt;
   &lt;m:intLim m:val="subSup"/&gt;
   &lt;m:naryLim m:val="undOvr"/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267"&gt;
  &lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/&gt;
  &lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/&gt;
  &lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/&gt;
  &lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/&gt;
  &lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/&gt;
  &lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/&gt;
  &lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="37" Name="Bibliography"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:1;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:variable;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin-top:0in;
	mso-para-margin-right:0in;
	mso-para-margin-bottom:10.0pt;
	mso-para-margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;Because
creating a unit test for every exception I needed to catch is not something I wanted
to do, not to mention that in my opinion using attributes doesn’t lend itself to easily
read code, I decided to look into re-creating the functionality.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;Using
generics and delegates I was able to accomplish this without too much of a headache,
other than the fact that my current contracting gig has me coding in VB and for some
reason when I am coding in VB I occasionally mix in some C# and when I am coding in
C# I mix in some VB…shouldn’t the IDE be smart enough to make the conversion for you?&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;So
I can now test for expected exceptions until I am blue in the face.&lt;span style=""&gt;&amp;nbsp; &lt;/span&gt;Here
is the above code rewritten using the AssertException class.&lt;/span&gt;
&lt;/div&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p class="MsoNormal"&gt;
&lt;span style="font-size: 11pt; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;pre&gt;&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///
&amp;lt;summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///A
test for ATestMethod&lt;/span&gt;
&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;///&amp;lt;/summary&amp;gt;&lt;/span&gt;
&lt;br&gt;
[TestMethod]&lt;br&gt;
[HostType(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"ASP.NET"&lt;/span&gt;)]&lt;br&gt;
[AspNetDevelopmentServerHost(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"%PathToWebRoot%\\Learning\\CustomAssertions\\CustomAssertions\\CustomAssertions"&lt;/span&gt;, &lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"/"&lt;/span&gt;)]&lt;br&gt;
[UrlToTest(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"http://localhost:1777/"&lt;/span&gt;)]&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; ATestMethodTestWithCustomAssertException()&lt;br&gt;
{&lt;br&gt;
&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;int&lt;/span&gt; actual &lt;span style="color: Red; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;=&lt;/span&gt; MethodsForTesting.ATestMethod(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Testing"&lt;/span&gt;);&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//This
is a valid, simple but still valid, test of the pass condition.&lt;/span&gt;
&lt;br&gt;
Assert.AreEqual(1, actual);&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Test
of the null argument logic&lt;/span&gt;
&lt;br&gt;
AssertException.Throws&amp;lt;ArgumentNullException&amp;gt;(() =&amp;gt; MethodsForTesting.ATestMethod(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;null&lt;/span&gt;));&lt;br&gt;
&lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//Test
of the string is too long logic&lt;/span&gt;
&lt;br&gt;
AssertException.Throws&amp;lt;InvalidOperationException&amp;gt;(() =&amp;gt; MethodsForTesting.ATestMethod(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"A
really looooooooooooooooooooooong string."&lt;/span&gt;));&lt;br&gt;
}&lt;br&gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;br&gt;
&lt;/span&gt;
&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CKBurnell%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;o:OfficeDocumentSettings&gt;
  &lt;o:RelyOnVML/&gt;
  &lt;o:AllowPNG/&gt;
 &lt;/o:OfficeDocumentSettings&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;link rel="themeData" href="file:///C:%5CDOCUME%7E1%5CKBurnell%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;
&lt;link rel="colorSchemeMapping" href="file:///C:%5CDOCUME%7E1%5CKBurnell%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:WordDocument&gt;
  &lt;w:View&gt;Normal&lt;/w:View&gt;
  &lt;w:Zoom&gt;0&lt;/w:Zoom&gt;
  &lt;w:TrackMoves/&gt;
  &lt;w:TrackFormatting/&gt;
  &lt;w:PunctuationKerning/&gt;
  &lt;w:ValidateAgainstSchemas/&gt;
  &lt;w:SaveIfXMLInvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;
  &lt;w:IgnoreMixedContent&gt;false&lt;/w:IgnoreMixedContent&gt;
  &lt;w:AlwaysShowPlaceholderText&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;
  &lt;w:DoNotPromoteQF/&gt;
  &lt;w:LidThemeOther&gt;EN-US&lt;/w:LidThemeOther&gt;
  &lt;w:LidThemeAsian&gt;X-NONE&lt;/w:LidThemeAsian&gt;
  &lt;w:LidThemeComplexScript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;
  &lt;w:Compatibility&gt;
   &lt;w:BreakWrappedTables/&gt;
   &lt;w:SnapToGridInCell/&gt;
   &lt;w:WrapTextWithPunct/&gt;
   &lt;w:UseAsianBreakRules/&gt;
   &lt;w:DontGrowAutofit/&gt;
   &lt;w:SplitPgBreakAndParaMark/&gt;
   &lt;w:DontVertAlignCellWithSp/&gt;
   &lt;w:DontBreakConstrainedForcedTables/&gt;
   &lt;w:DontVertAlignInTxbx/&gt;
   &lt;w:Word11KerningPairs/&gt;
   &lt;w:CachedColBalance/&gt;
  &lt;/w:Compatibility&gt;
  &lt;m:mathPr&gt;
   &lt;m:mathFont m:val="Cambria Math"/&gt;
   &lt;m:brkBin m:val="before"/&gt;
   &lt;m:brkBinSub m:val="&amp;#45;-"/&gt;
   &lt;m:smallFrac m:val="off"/&gt;
   &lt;m:dispDef/&gt;
   &lt;m:lMargin m:val="0"/&gt;
   &lt;m:rMargin m:val="0"/&gt;
   &lt;m:defJc m:val="centerGroup"/&gt;
   &lt;m:wrapIndent m:val="1440"/&gt;
   &lt;m:intLim m:val="subSup"/&gt;
   &lt;m:naryLim m:val="undOvr"/&gt;
  &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt;
&lt;/xml&gt;&lt;![endif]--&gt;
&lt;!--[if gte mso 9]&gt;&lt;xml&gt;
 &lt;w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267"&gt;
  &lt;w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 7"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 8"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" Name="toc 9"/&gt;
  &lt;w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/&gt;
  &lt;w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/&gt;
  &lt;w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/&gt;
  &lt;w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/&gt;
  &lt;w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/&gt;
  &lt;w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/&gt;
  &lt;w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/&gt;
  &lt;w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/&gt;
  &lt;w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/&gt;
  &lt;w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/&gt;
  &lt;w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/&gt;
  &lt;w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/&gt;
  &lt;w:LsdException Locked="false" Priority="37" Name="Bibliography"/&gt;
  &lt;w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/&gt;
 &lt;/w:LatentStyles&gt;
&lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt;
&lt;!--
 /* Font Definitions */
 @font-face
	{font-family:"Cambria Math";
	panose-1:2 4 5 3 5 4 6 3 2 4;
	mso-font-charset:1;
	mso-generic-font-family:roman;
	mso-font-format:other;
	mso-font-pitch:variable;
	mso-font-signature:0 0 0 0 0 0;}
@font-face
	{font-family:Calibri;
	panose-1:2 15 5 2 2 2 4 3 2 4;
	mso-font-charset:0;
	mso-generic-font-family:swiss;
	mso-font-pitch:variable;
	mso-font-signature:-1610611985 1073750139 0 0 159 0;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
	{mso-style-unhide:no;
	mso-style-qformat:yes;
	mso-style-parent:"";
	margin-top:0in;
	margin-right:0in;
	margin-bottom:10.0pt;
	margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoChpDefault
	{mso-style-type:export-only;
	mso-default-props:yes;
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:Calibri;
	mso-fareast-theme-font:minor-latin;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;
	mso-bidi-font-family:"Times New Roman";
	mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
	{mso-style-type:export-only;
	margin-bottom:10.0pt;}
@page Section1
	{size:8.5in 11.0in;
	margin:1.0in 1.0in 1.0in 1.0in;
	mso-header-margin:.5in;
	mso-footer-margin:.5in;
	mso-paper-source:0;}
div.Section1
	{page:Section1;}
--&gt;
&lt;/style&gt;
&lt;!--[if gte mso 10]&gt;
&lt;style&gt;
 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Table Normal";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-qformat:yes;
	mso-style-parent:"";
	mso-padding-alt:0in 5.4pt 0in 5.4pt;
	mso-para-margin-top:0in;
	mso-para-margin-right:0in;
	mso-para-margin-bottom:10.0pt;
	mso-para-margin-left:0in;
	mso-pagination:widow-orphan;
	font-size:11.0pt;
	font-family:"Calibri","sans-serif";
	mso-ascii-font-family:Calibri;
	mso-ascii-theme-font:minor-latin;
	mso-fareast-font-family:"Times New Roman";
	mso-fareast-theme-font:minor-fareast;
	mso-hansi-font-family:Calibri;
	mso-hansi-theme-font:minor-latin;}
&lt;/style&gt;
&lt;![endif]--&gt;&lt;span style="font-size: 11pt; font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;The
Throws method has an override that includes the expected error message as well.&amp;nbsp;
I also coded a ThrowsSoapException custom assertion that allows you to look for a
specific exception message as well as a specific soap fault code.&amp;nbsp; You can download
the rest of the code, including unit tests of course, &lt;a href="http://www.DotNetDevDude.com/Downloads/Code/CustomAssertions.zip"&gt;here&lt;/a&gt;.&lt;/span&gt;
&lt;br&gt;
&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://dotnetdevdude.com/Blog/aggbug.ashx?id=5ad8bc4b-6ecf-407e-9443-f159eb6342f4" /&gt;
&lt;br /&gt;
&lt;hr /&gt;
This weblog is sponsored by &lt;a href="http://www.newtelligence.com"&gt;newtelligence AG&lt;/a&gt;. &lt;a href="http://www.jetbrains.com/ruby/features?utm_source=RubyMineUser&amp;utm_medium=Banner&amp;utm_campaign=RubyMine" style="position: relative;display:block; width:120px; height:30px; border:0; margin:0;padding:0;text-decoration:none;text-indent:0;"&gt;&lt;span style="margin: 0;padding: 0;position: absolute;top: -2px;left: 33px;font-size: 9px;cursor:pointer;  background-image:none;border:0;color: #efcedc; font-family: trebuchet ms,arial,sans-serif;font-weight: normal;text-align:left;"&gt;Happy
fan of&lt;/span&gt;&lt;img src="http://www.jetbrains.com/ruby/features/ruby_banners/ruby1/ruby120x30_rubin.gif" alt="Happy fan of" border="0" /&gt;&lt;/a&gt;</description>
      <comments>http://dotnetdevdude.com/Blog/CommentView,guid,5ad8bc4b-6ecf-407e-9443-f159eb6342f4.aspx</comments>
      <category>Code</category>
    </item>
  </channel>
</rss>