<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Devlicio.us - Just the Tasty Bits</title><link>http://devlicio.us/blogs/</link><description>Your Agile .NET Community</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Devlicious" /><feedburner:info uri="devlicious" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item><title>Code coverage reports with NCover and MSBuild</title><link>http://feedproxy.google.com/~r/Devlicious/~3/LHbf-eHw9GE/code-coverage-reports-with-ncover-and-msbuild.aspx</link><pubDate>Tue, 09 Feb 2010 18:11:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55327</guid><dc:creator>sergiopereira</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;
I&amp;#39;ve been doing a lot of static analysis on our projects at work lately. As 
part of that task we added &lt;a href="http://www.ncover.com/"&gt;NCover&lt;/a&gt; to our automated build process. Our
build runs on Team Build (TFS) and is specified in an MSBuild file.

&lt;/p&gt;
&lt;p&gt;
We wanted to take code metrics very seriously and we purchased the 
complete version of the product to take full advantage of its 
capabilities.

&lt;/p&gt;
&lt;p&gt;
Getting NCover to run in your build is very simple and the online 
documentation will be enough to figure it out. The problem comes
when you begin needing to create more and more variations of the
reports. The online documentation is a little short on this aspect,
especially on how to use the MSBuild or NAnt custom tasks. I hear
they plan to update the site with better docs for the next version 
of the product.

&lt;/p&gt;
&lt;p&gt;
NCover Complete comes with 23 different types of reports and 
a ton of parameters that can be configured to produce far
more helpful reports than just sticking to the defaults.

&lt;/p&gt;
&lt;p&gt;
For example, we are working on a new release of our product and
we are pushing ourserves to produce more testable code and
write more unit tests for all the new code. The problem is
that the new code is a tiny fraction of the existing code and
the metrics get averaged down by the older code.

&lt;/p&gt;
&lt;p&gt;
The key is to separate the code coverage profiling (which is
done by NCover while it runs all the unit tests with NUnit) from
the reports rendering. That way we only run the code coverage once; and that
can sometimes take a good chunk of time and will produce the coverage data. 
Rednering the reports is much quicker since the NCover reporting engine can feed off the
coverage data as many times as we need, very quickly.

&lt;/p&gt;
&lt;p&gt;
Once we have the coverage data we can choose which report types we want 
to create, the thresholds for sufficient coverage, which assemblies/types/methods
we want to include/exclude from each report and where to save each of them.

&lt;h3&gt;Example&lt;/h3&gt;

&lt;p&gt;
To demonstrate what I just described in practice, I decided to take
an existing open source project and add NCover reporting to it. The
project I selected was &lt;a href="http://www.codeplex.com/AutoMapper"&gt;AutoMapper&lt;/a&gt; mostly because it&amp;#39;s not very big
and has decent test coverage.
&lt;/p&gt;
&lt;p&gt;
I downloaded the project&amp;#39;s source code from the repository and
added a file named AutoMapper.msbuild to its root directory. You
can &lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/sergio_5F00_pereira.2010.02/automapper.msbuild.zip"&gt;download 
this entire file&lt;/a&gt; but I&amp;#39;ll go over it piece by piece.
&lt;/p&gt;

&lt;p&gt;We start by just importing the MSBuild tasks that ship with NCover into our script and
declaring a few targets, including one to collect coverage data and one to generate the reports.
I added the NCover tasks dll to the project directory &lt;b&gt;tools/NCoverComplete&lt;/b&gt;.&lt;/p&gt;

&lt;pre name="code" class="xml:nogutter"&gt;&amp;lt;Project DefaultTargets=&amp;quot;RebuildReports&amp;quot; 
  xmlns=&amp;quot;http://schemas.microsoft.com/developer/msbuild/2003&amp;quot; &amp;gt;
  &amp;lt;UsingTask  TaskName=&amp;quot;NCover.MSBuildTasks.NCover&amp;quot; 
        AssemblyFile=&amp;quot;$(ProjectDir)tools\NCoverComplete\NCover.MSBuildTasks.dll&amp;quot;/&amp;gt;
  &amp;lt;UsingTask  TaskName=&amp;quot;NCover.MSBuildTasks.NCoverReporting&amp;quot; 
        AssemblyFile=&amp;quot;$(ProjectDir)tools\NCoverComplete\NCover.MSBuildTasks.dll&amp;quot;/&amp;gt;

  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;Configuration Condition=&amp;quot; &amp;#39;$(Configuration)&amp;#39; == &amp;#39;&amp;#39; &amp;quot;&amp;gt;Debug&amp;lt;/Configuration&amp;gt;
    &amp;lt;BuildDir&amp;gt;$(MSBuildProjectDirectory)\build\$(Configuration)&amp;lt;/BuildDir&amp;gt;
    &amp;lt;NUnitBinDirectoryPath&amp;gt;$(MSBuildProjectDirectory)\tools\NUnit&amp;lt;/NUnitBinDirectoryPath&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;Target Name=&amp;quot;RebuildReports&amp;quot; DependsOnTargets=&amp;quot;RunCoverage;ExportReports&amp;quot; &amp;gt;
    &amp;lt;Message Text=&amp;quot;We will rebuild the coverage data than refresh the reports.&amp;quot; 
          Importance=&amp;quot;High&amp;quot; /&amp;gt;
  &amp;lt;/Target&amp;gt;

  &amp;lt;Target Name=&amp;quot;RunCoverage&amp;quot; &amp;gt;
    &amp;lt;!-- snip --&amp;gt;
  &amp;lt;/Target&amp;gt;

  &amp;lt;Target Name=&amp;quot;ExportReports&amp;quot; &amp;gt;
    &amp;lt;!-- snip --&amp;gt;
  &amp;lt;/Target&amp;gt;
&amp;lt;/Project&amp;gt;&lt;/pre&gt;


&lt;p&gt;
	Now let&amp;#39;s look closely at the target that gathers the coverage data. All it
	does is tell NCover (NCover console really) to run NUnit over the
	AutoMapper.UnitTests.dll and save all the output to well-known locations.
&lt;/p&gt;

&lt;pre name="code" class="xml:nogutter"&gt;&amp;lt;Target Name=&amp;quot;RunCoverage&amp;quot; &amp;gt;
  &amp;lt;Message Text=&amp;quot;Starting Code Coverage Analysis (NCover) ...&amp;quot; Importance=&amp;quot;High&amp;quot; /&amp;gt;
  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;NCoverOutDir&amp;gt;$(MSBuildProjectDirectory)\build\NCoverOut&amp;lt;/NCoverOutDir&amp;gt;
    &amp;lt;NUnitResultsFile&amp;gt;build\NCoverOut\automapper-nunit-result.xml&amp;lt;/NUnitResultsFile&amp;gt;
    &amp;lt;NUnitOutFile&amp;gt;build\NCoverOut\automapper-nunit-Out.txt&amp;lt;/NUnitOutFile&amp;gt;
    &amp;lt;InputFile&amp;gt;$(BuildDir)\UnitTests\AutoMapper.UnitTests.dll&amp;lt;/InputFile&amp;gt;
  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;NCover ToolPath=&amp;quot;$(ProgramFiles)\NCover&amp;quot;
    ProjectName=&amp;quot;$(Scenario)&amp;quot;
    WorkingDirectory=&amp;quot;$(MSBuildProjectDirectory)&amp;quot;   
    TestRunnerExe=&amp;quot;$(NUnitBinDirectoryPath)\nunit-console.exe&amp;quot;

    TestRunnerArgs=&amp;quot;$(InputFile) /xml=$(NUnitResultsFile) /out=$(NUnitOutFile)&amp;quot;

    AppendTrendTo=&amp;quot;$(NCoverOutDir)\automapper-coverage.trend&amp;quot;
    CoverageFile=&amp;quot;$(NCoverOutDir)\automapper-coverage.xml&amp;quot;
    LogFile=&amp;quot;$(NCoverOutDir)\automapper-coverage.log&amp;quot;
    IncludeTypes=&amp;quot;AutoMapper\..*&amp;quot;
    ExcludeTypes=&amp;quot;AutoMapper\.UnitTests\..*;AutoMapper\.Tests\..*&amp;quot;
    SymbolSearchLocations=&amp;quot;Registry, SymbolServer, BuildPath, ExecutingDir&amp;quot;
  /&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/pre&gt;

&lt;p&gt;
	Of special interest in the NCover task above are the output files named
	&lt;b&gt;$(Scenario)-coverage.xml&lt;/b&gt; and &lt;b&gt;$(Scenario)-coverage.trend&lt;/b&gt;, which
	contain the precious coverage data and historical trending respectively. In case
	you&amp;#39;re curious, the trend file is actually a SQLite3 database file that you
	can report directly from or export to other database formats if you want.
&lt;/p&gt;
&lt;p&gt;
	Also note the &lt;code&gt;IncludeTypes&lt;/code&gt; and &lt;code&gt;ExcludeTypes&lt;/code&gt; parameters,
	which guarantee that we are not tracking coverage on code that we don&amp;#39;t care.
&lt;/p&gt;

&lt;p&gt;
	Now that we have our coverage and trend data collected and saved to
	files we know, we can run as many reports as we want without needing
	to execute the whole set of tests again. That&amp;#39;s in the next target.
&lt;/p&gt;


&lt;pre name="code" class="xml:nogutter"&gt;&amp;lt;Target Name=&amp;quot;ExportReports&amp;quot; &amp;gt;
  &amp;lt;Message Text=&amp;quot;Starting Producing NCover Reports...&amp;quot; Importance=&amp;quot;High&amp;quot; /&amp;gt;
  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;Scenario&amp;gt;AutoMapper-Full&amp;lt;/Scenario&amp;gt;
    &amp;lt;NCoverOutDir&amp;gt;$(MSBuildProjectDirectory)\build\NCoverOut&amp;lt;/NCoverOutDir&amp;gt;
    &amp;lt;RptOutFolder&amp;gt;$(NCoverOutDir)\$(Scenario)Coverage&amp;lt;/RptOutFolder&amp;gt;
    &amp;lt;Reports&amp;gt;
      &amp;lt;Report&amp;gt;
        &amp;lt;ReportType&amp;gt;FullCoverageReport&amp;lt;/ReportType&amp;gt;
        &amp;lt;OutputPath&amp;gt;$(RptOutFolder)\Full\index.html&amp;lt;/OutputPath&amp;gt;
        &amp;lt;Format&amp;gt;Html&amp;lt;/Format&amp;gt;
      &amp;lt;/Report&amp;gt;
      &amp;lt;Report&amp;gt;
        &amp;lt;ReportType&amp;gt;SymbolModuleNamespaceClass&amp;lt;/ReportType&amp;gt;
        &amp;lt;OutputPath&amp;gt;$(RptOutFolder)\ClassCoverage\index.html&amp;lt;/OutputPath&amp;gt;
        &amp;lt;Format&amp;gt;Html&amp;lt;/Format&amp;gt;
      &amp;lt;/Report&amp;gt;
      &amp;lt;Report&amp;gt;
        &amp;lt;ReportType&amp;gt;Trends&amp;lt;/ReportType&amp;gt;
        &amp;lt;OutputPath&amp;gt;$(RptOutFolder)\Trends\index.html&amp;lt;/OutputPath&amp;gt;
        &amp;lt;Format&amp;gt;Html&amp;lt;/Format&amp;gt;
      &amp;lt;/Report&amp;gt;
    &amp;lt;/Reports&amp;gt;
    &amp;lt;SatisfactoryCoverage&amp;gt;
      &amp;lt;Threshold&amp;gt;
        &amp;lt;CoverageMetric&amp;gt;MethodCoverage&amp;lt;/CoverageMetric&amp;gt;
        &amp;lt;Type&amp;gt;View&amp;lt;/Type&amp;gt;
        &amp;lt;Value&amp;gt;80.0&amp;lt;/Value&amp;gt;
      &amp;lt;/Threshold&amp;gt;
      &amp;lt;Threshold&amp;gt;
        &amp;lt;CoverageMetric&amp;gt;SymbolCoverage&amp;lt;/CoverageMetric&amp;gt;
        &amp;lt;Value&amp;gt;80.0&amp;lt;/Value&amp;gt;
      &amp;lt;/Threshold&amp;gt;
      &amp;lt;Threshold&amp;gt;
        &amp;lt;CoverageMetric&amp;gt;BranchCoverage&amp;lt;/CoverageMetric&amp;gt;
        &amp;lt;Value&amp;gt;80.0&amp;lt;/Value&amp;gt;
      &amp;lt;/Threshold&amp;gt;
      &amp;lt;Threshold&amp;gt;
        &amp;lt;CoverageMetric&amp;gt;CyclomaticComplexity&amp;lt;/CoverageMetric&amp;gt;
        &amp;lt;Value&amp;gt;8&amp;lt;/Value&amp;gt;
      &amp;lt;/Threshold&amp;gt;
    &amp;lt;/SatisfactoryCoverage&amp;gt;

  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;NCoverReporting 
    ToolPath=&amp;quot;$(ProgramFiles)\NCover&amp;quot;
    CoverageDataPaths=&amp;quot;$(NCoverOutDir)\automapper-coverage.xml&amp;quot;
    LoadTrendPath=&amp;quot;$(NCoverOutDir)\automapper-coverage.trend&amp;quot;
    ProjectName=&amp;quot;$(Scenario) Code&amp;quot;
    OutputReport=&amp;quot;$(Reports)&amp;quot;
    SatisfactoryCoverage=&amp;quot;$(SatisfactoryCoverage)&amp;quot;
  /&amp;gt;
&amp;lt;/Target&amp;gt;&lt;/pre&gt;

&lt;p&gt;
	What you can see in this target is that we are creating three different
	reports, represented by the &lt;code&gt;Report&lt;/code&gt; elements and that
	we are changing the satisfactory threshold to 80% code coverage 
	(down from the default of 95%) and the maximum cyclomatic complexity 
	to 8. These two blocks of configuration are passer to the NCoverReporting
	task via the parameters &lt;code&gt;OutputReport&lt;/code&gt; and &lt;code&gt;SatisfactoryCoverage&lt;/code&gt;, 
	respectively.
&lt;/p&gt;

&lt;p&gt;
	The above reports are shown in the images below.
&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/sergio_5F00_pereira.2010.02/ncover_2D00_full.png"&gt;&lt;img src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/sergio_5F00_pereira.2010.02/ncover_2D00_full_2D00_small.png" border="0" alt="" /&gt;&lt;/a&gt;

&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/sergio_5F00_pereira.2010.02/ncover_2D00_class.png"&gt;&lt;img src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/sergio_5F00_pereira.2010.02/ncover_2D00_class_2D00_small.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;br /&gt;
&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/sergio_5F00_pereira.2010.02/ncover_2D00_trend.png"&gt;&lt;img src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/sergio_5F00_pereira.2010.02/ncover_2D00_trend_2D00_small.png" border="0" alt="" /&gt;&lt;/a&gt;
&lt;/p&gt;


&lt;h3&gt;Focus on specific areas&lt;/h3&gt;

&lt;p&gt;
	Let&amp;#39;s now say that, in addition to the reports for the entire source code, we
	also want to keep a closer eye on the classes under the &lt;code&gt;AutoMapper.Mappers&lt;/code&gt;
	namespace. We can get that going with another reporting target, filtering the reported
	data down to just the code we are interested in:
&lt;/p&gt;

&lt;pre name="code" class="xml:nogutter"&gt;&amp;lt;Target Name=&amp;quot;ExportReportsMappers&amp;quot; &amp;gt;
  &amp;lt;Message Text=&amp;quot;Reports just for the Mappers&amp;quot; Importance=&amp;quot;High&amp;quot; /&amp;gt;
  &amp;lt;PropertyGroup&amp;gt;
    &amp;lt;Scenario&amp;gt;AutoMapper-OnlyMappers&amp;lt;/Scenario&amp;gt;
    &amp;lt;NCoverOutDir&amp;gt;$(MSBuildProjectDirectory)\build\NCoverOut&amp;lt;/NCoverOutDir&amp;gt;
    &amp;lt;RptOutFolder&amp;gt;$(NCoverOutDir)\$(Scenario)Coverage&amp;lt;/RptOutFolder&amp;gt;
    &amp;lt;Reports&amp;gt;
      &amp;lt;Report&amp;gt;
        &amp;lt;ReportType&amp;gt;SymbolModuleNamespaceClass&amp;lt;/ReportType&amp;gt;
        &amp;lt;OutputPath&amp;gt;$(RptOutFolder)\ClassCoverage\index.html&amp;lt;/OutputPath&amp;gt;
        &amp;lt;Format&amp;gt;Html&amp;lt;/Format&amp;gt;
      &amp;lt;/Report&amp;gt;
      &amp;lt;!-- add more Report elements as desired --&amp;gt;
    &amp;lt;/Reports&amp;gt;
    &amp;lt;CoverageFilters&amp;gt;
      &amp;lt;Filter&amp;gt;
        &amp;lt;Pattern&amp;gt;AutoMapper\.Mappers\..*&amp;lt;/Pattern&amp;gt;
        &amp;lt;Type&amp;gt;Class&amp;lt;/Type&amp;gt;
        &amp;lt;IsRegex&amp;gt;True&amp;lt;/IsRegex&amp;gt;
        &amp;lt;IsInclude&amp;gt;True&amp;lt;/IsInclude&amp;gt;
      &amp;lt;/Filter&amp;gt;
      &amp;lt;!-- include/exclude more classes, assemblies, namespaces, 
      methods, files as desired --&amp;gt;
    &amp;lt;/CoverageFilters&amp;gt;

  &amp;lt;/PropertyGroup&amp;gt;

  &amp;lt;NCoverReporting 
    ToolPath=&amp;quot;$(ProgramFiles)\NCover&amp;quot;
    CoverageDataPaths=&amp;quot;$(NCoverOutDir)\automapper-coverage.xml&amp;quot;
    ClearCoverageFilters=&amp;quot;true&amp;quot;
    CoverageFilters=&amp;quot;$(CoverageFilters)&amp;quot;
    LoadTrendPath=&amp;quot;$(NCoverOutDir)\automapper-coverage.trend&amp;quot;
    ProjectName=&amp;quot;$(Scenario) Code&amp;quot;
    OutputReport=&amp;quot;$(Reports)&amp;quot;
  /&amp;gt;
&amp;lt;/Target/&amp;gt;&lt;/pre&gt;

&lt;p&gt;
	Now that we have this basic template our plan is to identify
	problem areas in the code and create reports aimed at them.
	The URLs of the reports will be included in the CI build reports 
	and notification emails.
&lt;/p&gt;
&lt;p&gt;
	It&amp;#39;s so easy to add more reports that we will have reports
	that will live for a single release cycle or even less if
	we need it.
&lt;/p&gt;
&lt;p&gt;
	I hope this was helpful for more people because it did take
	a good amount of time to get it all sorted out. Even if
	you&amp;#39;re using NAnt instead of MSBuild, the syntax is
	similar and I&amp;#39;m sure you can port the idea easily.
&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55327" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/LHbf-eHw9GE" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/sergio_pereira/archive/tags/.NET/default.aspx">.NET</category><category domain="http://devlicio.us/blogs/sergio_pereira/archive/tags/Tips-and-Tricks/default.aspx">Tips-and-Tricks</category><category domain="http://devlicio.us/blogs/sergio_pereira/archive/tags/Automation/default.aspx">Automation</category><category domain="http://devlicio.us/blogs/sergio_pereira/archive/tags/UnitTesting/default.aspx">UnitTesting</category><feedburner:origLink>http://devlicio.us/blogs/sergio_pereira/archive/2010/02/09/code-coverage-reports-with-ncover-and-msbuild.aspx</feedburner:origLink></item><item><title>Help my DataContracts do not show up in my WCF Services</title><link>http://feedproxy.google.com/~r/Devlicious/~3/F2VX1cZC-tI/help-my-datacontracts-do-not-show-up-in-my-wcf-services.aspx</link><pubDate>Tue, 09 Feb 2010 11:28:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55324</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;The other day I refreshed one of our WCF services (right click the service and do a Update Service Reference) and all of a sudden I got a metric crap-ton of build errors. In each place I received the error it told me that the type was not found.&amp;nbsp; At first I could not understand what was going on, in fact I was sure the compiler was playing tricks on me (cause we all the compiler has a devilish sense of humor) because how could it be possible that all of my types went missing.&lt;/p&gt;
&lt;p&gt;Just to be sure I took a look at the generated code in the Reference.cs class and sure enough all my types were missing. &lt;/p&gt;
&lt;p&gt;Now that I know the compiler is not just playing tricks on me it was time to find out what happened.&lt;/p&gt;
&lt;p&gt;The first thing I did was to try recompiling the service and updating my references again, but as you could have guessed this did not solve my problem.&amp;nbsp; Next I decided to try to create a duplicate reference to the service to see if maybe my original reference was screwed up, and as you may have guess the new reference also was missing my types (shocking I know).&amp;nbsp; At this point I was a bit stumped, and did not know exactly what could have caused the issue.&amp;nbsp; I next decided to take a look at the service configuration so I right clicked on the service and selected &amp;lsquo;Configure Service Reference&amp;rsquo;.&amp;nbsp; When I did this the screen below appeared&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_1256B0D3.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="image" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/image_5F00_thumb_5F00_3F6B9DA1.png" border="0" height="386" width="424" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;After looking at this for a few minutes it dawned on me what had happened.&amp;nbsp; The check box (one circled in red) was selected (and is by default) and someone on the team had added direct reference to the assembly which contained my Models that were provided via the web service.&amp;nbsp; I decided to uncheck that check box and give that a whirl and sure enough my Models came pack.&amp;nbsp; Now that I was back up and running, it was time to remove the direct reference from my project to the assembly which hosts my WCF service as there is no point in both referring to it locally as well as hitting it via a service.&lt;/p&gt;
&lt;p&gt;Long story short, if you refresh your WCF reference and all your Data Contract Models disappear there are 2 things you need to look for. &lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Are you referencing the service assembly locally (if so why?)&lt;/li&gt;
&lt;li&gt;Do you have the &amp;lsquo;reuse types&amp;rsquo; check box selected in the WCF configuration screen?&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;If either (or both) of the above are set then you should have your solution.&lt;/p&gt;
&lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55324" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/F2VX1cZC-tI" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/HowTo/default.aspx">HowTo</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/WCF/default.aspx">WCF</category><feedburner:origLink>http://devlicio.us/blogs/derik_whittaker/archive/2010/02/09/help-my-datacontracts-do-not-show-up-in-my-wcf-services.aspx</feedburner:origLink></item><item><title>ASP.NET MVC in the Wild</title><link>http://feedproxy.google.com/~r/Devlicious/~3/qoc-1kljOQo/asp-net-mvc-in-the-wild.aspx</link><pubDate>Tue, 09 Feb 2010 11:02:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55322</guid><dc:creator>Jak Charlton</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;Just before I emigrated to Australia, I took on a small contract to build a website for a UK company who wanted to start up a new kind of UK recruitment site, one where employers could advertise directly, and more specifically one where recruitment agencies couldn&amp;rsquo;t.&lt;/p&gt;
&lt;p&gt;The result was Empty Lemon (&lt;a href="http://www.emptylemon.co.uk"&gt;www.emptylemon.co.uk&lt;/a&gt;) &amp;ndash; I leave you to figure out why it is called Empty Lemon, took me a fair while to be honest!&lt;/p&gt;
&lt;p&gt;This site was built in around 4 weeks, using ASP.NET MVC2, NHibernate, Fluent NHibernate, Windsor, JQuery, Automapper, and a host of other great tools and libraries.&lt;/p&gt;
&lt;p&gt;The site is actually, despite the occasional bit of code I&amp;rsquo;m not too delighted with, a great example of how fast a site can be developed with ASP.NET MVC and the chosen tooling. In just four weeks we went from more or less nothing, to a full domain model (all be it a fairly simple one) running over a SQL Server 2008 database, using a combination of NH, Fulltext search and the Spatial services from SQL Server 2008.&lt;/p&gt;
&lt;p&gt;I also want to thank James Gregory, Steve Strong and Hadi Hariri for (sometimes unknowingly) helping me write the site, with useful snippets of code, and even in Steve&amp;rsquo;s case a lot of work on getting NH to play fair with the spatial services.&lt;/p&gt;
&lt;p&gt;So, if you are looking for a job in the UK, or if you are looking to employ someone, I strongly suggest you take a look at &lt;a href="http://www.emptylemon.co.uk"&gt;www.emptylemon.co.uk&lt;/a&gt;. It&amp;rsquo;s a little empty right now, but some large employers are coming on board soon, and other companies are signing up day by day &amp;ndash; these things are always chicken and egg, so if you like the site, feel free to tell others about it &amp;ndash; after all, who really likes recruitment agents anyway ;)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55322" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/qoc-1kljOQo" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/casey/archive/tags/.NET/default.aspx">.NET</category><category domain="http://devlicio.us/blogs/casey/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category><category domain="http://devlicio.us/blogs/casey/archive/tags/JQuery/default.aspx">JQuery</category><category domain="http://devlicio.us/blogs/casey/archive/tags/Castle/default.aspx">Castle</category><category domain="http://devlicio.us/blogs/casey/archive/tags/NHibernate/default.aspx">NHibernate</category><feedburner:origLink>http://devlicio.us/blogs/casey/archive/2010/02/09/asp-net-mvc-in-the-wild.aspx</feedburner:origLink></item><item><title>Upcoming Events for 2010</title><link>http://feedproxy.google.com/~r/Devlicious/~3/OI7d6C-V-YE/upcoming-events-for-2010.aspx</link><pubDate>Sun, 07 Feb 2010 02:38:34 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55298</guid><dc:creator>Rob Reynolds</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;One of my goals for the year was to speak at least three times this year and from the looks of things, it appears I’ll meet that goal in the first half of the year. &lt;/p&gt;  &lt;p&gt;This is what’s going on this year for me (subject to additions/changes):&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Rocky Mountain Tech Tri-Fecta 2.0 - &lt;a title="http://rmtechtrifecta.pbworks.com/" href="http://rmtechtrifecta.pbworks.com/"&gt;http://rmtechtrifecta.pbworks.com/&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Coders For Charities (C4C) - &lt;a title="http://coders4charities.org/" href="http://coders4charities.org/"&gt;http://coders4charities.org/&lt;/a&gt; &lt;/li&gt;    &lt;li&gt;Chicago Alt.NET May Meeting &lt;/li&gt;    &lt;li&gt;KC .NET UG July Meeting &lt;/li&gt;    &lt;li&gt;Kansas City Developer Conference (KCDC) &lt;/li&gt;    &lt;li&gt;Virtual Alt.NET Meetings &lt;/li&gt;    &lt;li&gt;Other Events &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;Rocky Mountain Tech Tri-Fecta 2.0&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;RMTT (hash tag #rmtt) will be the last weekend of February. I’m going to be doing a Birds of a Feather presentation. From what I understand, the BoF presentations will be at 7AM for one hour. I will be facilitating/leading a group discussion on automation tools. Here is the abstract: &lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Build/Deploy Automation &amp;amp; Developer Automation Tools&lt;/strong&gt;&lt;/p&gt;    &lt;p&gt;This will be an open discussion about build/deploy and developer automation. In the .NET world, there has been a serious need for better tooling in this area and we can discuss the needs/deficits. If the conversation steers toward demos, we can take a look at a build tool called UppercuT, which is the fastest zero to professional build you will find in the .Net market to date (plus it&amp;#39;s 100% free!). We can also look at a database change management tool known as RoundhousE. Another tool that may be shown is a project (solution and everything else) templating tool known as Warmup. Other tools are open for discussion and demos. If you have a developer automation tool you love, or you are are a developer automation tool builder, come ready to discuss your tools! &lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;Coders For Charities&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;Coders For Charities (hash tag #c4c) will be the last weekend of March. This is the 3rd Annual C4C event where “dozens of Kansas City area web developers, designers, and business analysts will engage with local non-profit organizations for a weekend of ‘giving back’ to their communities.” This is something I’ve been wanting to do since the first event three years ago. It looks like an awesome event. If you are in the KC area and you haven’t already signed up for this event, what are you waiting for? This is going to be a great place to meet other developers and work hard on something that benefits a charity or non-profit organization.&lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;Chicago Alt.NET May Meeting&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;I believe I will be presenting on &lt;a href="http://projectuppercut.org/" target="_blank"&gt;UppercuT&lt;/a&gt; when I go out to Chicago Alt.NET’s monthly meeting in May. I’ve never been to Chicago, and I’ve heard that it’s beautiful in May. There may be some touring in order. I’m pretty excited to get out to see the sites and hang out with a bunch of cool, smart people up in the windy city. If I present on UppercuT, this is the abstract:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Automated Builds: How to UppercuT Your Code!&lt;/strong&gt;       &lt;br /&gt;“Build – it’s not just for F5 anymore.” &lt;/p&gt;    &lt;p&gt;How you build your code and verify quality is something that is usually not thought of at the beginning of a project, but is one of the most important things you can add to code! During this session we will go over the conventions in building and verifying code quality. We will see a project that is using automated builds and how all of the conventions are applied. We are going to see UppercuT and how well suited it is for automated builds. UppercuT is a build framework (based in NAnt) that allows rapid and powerful use of NAnt without having to understand the intricacies of NAnt. The last thing we will do is apply UppercuT to a project to show you how fast you can go from F5 to automated builds!&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;KC .NET User Group July Meeting&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;At the KC DNUG I’ll be presenting on &lt;a href="http://projectroundhouse.org/" target="_blank"&gt;RoundhousE&lt;/a&gt; in July. KC DNUG is a fantastic group and I enjoy every event I can get to with them! Here is the abstract:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;strong&gt;Database Change Management with RoundhousE!&lt;/strong&gt;       &lt;br /&gt;&amp;quot;Because kicking your database is a good thing!&amp;quot;&lt;/p&gt;    &lt;p&gt;     &lt;br /&gt;Many would not argue that you need to version your code, and few would argue that you should version your code in a way that can lead you back to a specific point in source control history. However, most people don&amp;#39;t really think of doing the same with your database. That&amp;#39;s where RoundhousE comes in. RoundhousE versions your database how you want. Not to mention it&amp;#39;s one of the most intelligent database migrations tools out there, it also helps you keep your scripts in source control in a way that makes sense. We&amp;#39;ll walk through the tool and its features and then open for questions. You&amp;#39;ll see how it can make database change management extremely simple for you and how it makes auditors and DBAs smile. RoundhousE - you know you want to learn more...&lt;/p&gt; &lt;/blockquote&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;Kansas City Developers Conference&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;KCDC (hash tag #kcdc) doesn’t have a firm date yet from what I hear. I don’t know much about this one yet, other than that I am so there. Hopefully talking about something cool as well!&lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;Virtual Alt.NET Meetings&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;&lt;a href="http://www.virtualaltnet.com/" target="_blank"&gt;Virtual Alt.NET&lt;/a&gt;, lovingly known as the VAN hosts meetings on Wednesday nights. Now I believe that is going to be once a month.&amp;#160; I’m hoping to present on two topics this year. One of those is UppercuT and the other is RoundhousE (same abstracts as above). The dates for these are not set in stone yet, and I probably shouldn’t be trying to jinx it by talking about them yet! I’m really excited to do a presentation online though and how that will work out!&lt;/p&gt;  &lt;h4&gt;&lt;strong&gt;&lt;u&gt;Other Events&lt;/u&gt;&lt;/strong&gt;&lt;/h4&gt;  &lt;p&gt;I loved &lt;a href="http://iowacodecamp.com/" target="_blank"&gt;Iowa Code Camp&lt;/a&gt; last year. It was awesome! I am definitely looking forward to another round with a bunch of awesome guys/gals! &lt;a href="http://techfests.com/Tulsa/" target="_blank"&gt;Tulsa TechFest&lt;/a&gt; was another event I really enjoyed and I would like to get back to this year. One I’ve never been to and think I would like to check out is the &lt;a href="http://www.heartlanddc.com/" target="_blank"&gt;Heartland Developers Conference&lt;/a&gt; (HDC).&lt;/p&gt;  &lt;p&gt;I’m open to other cool events and meeting more people smarter than I am. What conferences are you going to that I might find interesting?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55298" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/OI7d6C-V-YE" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/RoundhousE/default.aspx">RoundhousE</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/UppercuT/default.aspx">UppercuT</category><feedburner:origLink>http://devlicio.us/blogs/rob_reynolds/archive/2010/02/06/upcoming-events-for-2010.aspx</feedburner:origLink></item><item><title>Solving Complexity with Message Based Architectures </title><link>http://feedproxy.google.com/~r/Devlicious/~3/on-3ch0D5lg/solving-complexity-with-message-based-architectures.aspx</link><pubDate>Thu, 04 Feb 2010 07:55:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55264</guid><dc:creator>Jak Charlton</dc:creator><slash:comments>6</slash:comments><description>&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;Ultimately most complexity in software comes not from the
requirements, the business logic, or even the underlying systems. Most
complexity comes out of a poorly considered and managed architecture, and this
is commonly seen in tightly coupled systems that rapidly degrade into Big Balls
of Mud.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;The key to simplifying architectures is to decouple their
component parts, making each more specialised and less dependent on the
others. This allows every component to focus on a specific task without risk of
those tasks becoming compromised by, or interfering with, others.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;The basic premise of most architectures that succeed in
this way is that they are message based, rather than being glorified CRUD
systems pulling data to and from databases. Operations are central to the
system, data is ultimately just the storage for the results of those
operations.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;This separation of concerns allows development teams to
concentrate on component parts with little impact upon other teams, and no more
reliance upon them than an agreement on the messages they will listen for and
those they will publish. While messages share some characteristics of service
interfaces, they differ mostly in their granularity and lack of dependence upon
one another. Messages allow true decoupling, where traditional service layers
only promise this and usually end up creating even more tightly coupled
systems.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;&amp;quot;Message based&amp;quot; does not inherently mean SOA, and in many
ways differs substantially. Although both can be considered message based, SOA
brings significant overhead and generalisation, along with an organisation wide
remit. Simple message based systems operate on the basis of message within the application
rather than across an enterprise.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;Poor software architecture ends up impacting more than
just the software system under development, and frequently the impact can be
felt across an organisation; in the way development teams approach problems, in
the way they respond to new requirements, and throughout the SDLC.&lt;/p&gt;
&lt;p class="MsoPlainText"&gt;More often than not, the SDLC is a reflection of the weaknesses
in software architecture, and is frequently trying to play &amp;#39;catch up&amp;#39; to attempt
to deal with the issues weak architecture brings. These compromises and aspects
of the SDLC then start to propagate and impact other areas of the development and
support process. Often decisions about software architecture become the underlying
drivers for the entire IT department, and the SDLC turns into a point of
conflict as it becomes more about trying to restrain and control a big ball of
mud than it does about providing a framework for providing business value.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55264" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/on-3ch0D5lg" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/casey/archive/tags/Practices+and+Principles/default.aspx">Practices and Principles</category><category domain="http://devlicio.us/blogs/casey/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://devlicio.us/blogs/casey/archive/tags/DDD/default.aspx">DDD</category><category domain="http://devlicio.us/blogs/casey/archive/tags/SOA/default.aspx">SOA</category><feedburner:origLink>http://devlicio.us/blogs/casey/archive/2010/02/04/solving-complexity-with-message-based-architectures.aspx</feedburner:origLink></item><item><title>Architectural Paradigms of Robotic Control</title><link>http://feedproxy.google.com/~r/Devlicious/~3/o9zDh8DII1s/software-architectural-approaches-for-robotics.aspx</link><pubDate>Wed, 03 Feb 2010 22:39:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55261</guid><dc:creator>Billy McCafferty</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;strong&gt;Introducing a New Blog Series&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Rarely do I make new year&amp;#39;s resolution. &amp;nbsp;But I found myself pinky swearing myself a single resolution for this year: &amp;nbsp;write a series of tractable posts concerning the development of software for robotics. &amp;nbsp;Accordingly, I intend to introduce background, techniques, and examples with respect to the following topics and more:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Software Architectural Approaches for Robotics (e.g., Deliberative, Reactive, Hybrid)&lt;/li&gt;
&lt;li&gt;Software Design Methodologies (e.g., for Behavior Based Robotics, for Hierarchical)&lt;/li&gt;
&lt;li&gt;Integration Patterns (Message Channels, Publish/Subscriber, RPC)&lt;/li&gt;
&lt;li&gt;Machine Learning and Adaptation Techniques (Neural Nets, Genetic Algorithms, Fuzzy Logic)&lt;/li&gt;
&lt;li&gt;Planning Algorithms (Discrete Planning, Continuous Spaces, Motion Planning)&lt;/li&gt;
&lt;li&gt;Simultaneous Localization and Mapping Techniques (Kalman Filters, Particle Filters)&lt;/li&gt;
&lt;li&gt;Tools &amp;amp; Frameworks (Microsoft Robotics Studio, Robot Operating System)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;I&amp;#39;m writing this series of posts for two reasons. &amp;nbsp;The first, as always, is to bounce ideas off readers as a sanity check. &amp;nbsp;The second is to instill interest in readers in this rapidly evolving field. &amp;nbsp;The sophistication of software algorithms within robotics is beginning to lag behind the potential capabilities of available hardware. &amp;nbsp;Accordingly, if this series acts as motivational tool to get others involved in tackling the current algorithmic challenges involved in robotics, then all the better.&lt;/p&gt;
&lt;p&gt;To make this series more interesting and applicable to the development audience that reads &lt;a&gt;http://devlicio.us&lt;/a&gt;, I will attempt, when appropriate, to focus on patterns and general techniques that could possibly be applicable to scenarios outside of robotics. &amp;nbsp;Additionally, due to this series&amp;#39; focus on software, I&amp;#39;ll concentrate on leveraging simulators over physical, often expensive, robotics hardware to make it easier for readers to duplicate provided examples.&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;hr /&gt;
&lt;p&gt;&lt;strong&gt;Introduction to Architectural Paradigms of Robotic Control&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;While &amp;quot;architecture&amp;quot; is likely one of the least definable terms in software development, it is unavoidably a topic which has one of the greatest impacts on the extensibility and maintainability of an application. &amp;nbsp;Indeed, a frequent cause of an application re-write is due to the architectural decisions that were made early in the project, or the lack thereof. &amp;nbsp;Certainly one of the difficulties in instituting proper architectural practices in a project lies in the fact that architectural decisions must carefully be decided at many different levels of project development. &amp;nbsp;Obviously, the architectural decisions at each level should be made in context of the project requirements in order to facilitate a proper balance of speed of development, scalability of development, and maintainability of the application in the future.&lt;/p&gt;
&lt;p&gt;To illustrate, consider a basic eCommerce site vs. a corporate financial management application which integrates with various third party tools. &amp;nbsp;There are two aspects of architecture which must be carefully considered. &amp;nbsp;The first is deciding which project contexts will require architectural consideration. &amp;nbsp;The second is defining the architectural approach to meet the needs of the given project context, and implementing any necessary prefactoring, accordingly.&lt;/p&gt;
&lt;p&gt;For a basic eCommerce site, the project contexts requiring architectural consideration would likely include: &amp;nbsp;appropriate separation between presentation and control, separation between control and the domain, separation between the domain and data access, and appropriate integration with a payment gateway. &amp;nbsp;Perhaps the &lt;a href="http://en.wikipedia.org/wiki/Active_record_pattern"&gt;active record pattern&lt;/a&gt; might be chosen as the data access mechanism. &amp;nbsp;If&amp;nbsp;&lt;a href="http://martinfowler.com/articles/injection.html"&gt;inversion of control&lt;/a&gt;&amp;nbsp;seems overkill for such a small application, perhaps direct communications to the payment gateway via the domain objects might be chosen as the means of integration. &amp;nbsp;Accordingly, &lt;a href="http://devlicious.com/blogs/billy_mccafferty/archive/2006/09/20/Planning-for-vs.-Reacting-to-Change.aspx"&gt;judicious prefactoring&lt;/a&gt; would suggest that an &lt;a href="http://www.agile-architecting.com/Architecture%20Spikes.pdf"&gt;architectural spike&lt;/a&gt; be created demonstrating appropriate use of the active record pattern with a selected tool along with an example of how and where integration with the payment gateway would take place.&lt;/p&gt;
&lt;p&gt;For the more complex and demanding needs of the financial management application, architecture considerations, in addition to those taken into account for the basic eCommerce site, might include: &amp;nbsp;what integration patterns might be leveraged to facilitate client integration, messaging patterns that might facilitate server side integration with third party financial calculators, and where inversion of control is appropriate. &amp;nbsp;Perhaps &lt;a href="http://en.wikipedia.org/wiki/Representational_State_Transfer"&gt;RESTful services&lt;/a&gt; would be included to provide integration support for clients requiring such capabilities. &amp;nbsp;Messaging via a &lt;a href="http://en.wikipedia.org/wiki/Publish/subscribe"&gt;publish/subscribe&lt;/a&gt; mechanism using a &lt;a href="http://www.eaipatterns.com/DistributionAggregate.html"&gt;composed message processor&lt;/a&gt; might be selected as the ideal means for coordinating data with third party vendors on the server side. &amp;nbsp;Again, proper refactoring, from an architectural perspective would include developing architectural spikes along with the foundational pieces of such an application to provide appropriate guidance for developers assisting with the project.&lt;/p&gt;
&lt;p&gt;Developing software for robotics is no different, in this respect, than developing any other application. &amp;nbsp;One must decide where the key architectural decisions need to be made and then provide adequate decisions and guidance to facilitate development in accordance with those decisions. &amp;nbsp;As stated, these decisions must be made in consideration of the project needs. &amp;nbsp;This post focuses on one project context, the architectural context of determining the overall approach to robotic motor control. &amp;nbsp;We&amp;#39;ll delve into three major architectural approaches to motor control along with highlighting a few specific implementations.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Deliberative vs. Reactive Robotics&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Certainly the best source of intelligent systems to study and emulate are those found in nature. &amp;nbsp;From the humble ant to the&amp;nbsp;exalted&amp;nbsp;human, evolution has honed a variety of strategies for dealing with the physical world. &amp;nbsp;Accordingly, if we are to create intelligent systems, a good place to start is by emulating the behaviors and responses to stimuli demonstrated by living creatures.&lt;/p&gt;
&lt;p&gt;In the early days of robotics, it was presumed that the most effective approach to emulating intelligence was by taking in detailed measurements provided by sensors, creating an internal representation of the world (e.g., grid-based maps), making plans based on that internal representation, and sending pre-planned commands to &lt;i&gt;actuators&lt;/i&gt; (devices which convert energy into motion) for moving and interacting with the world. &amp;nbsp;Inevitable, this approach presumes that the internal representation of the world is highly accurate, that the sensor reading are precise, and that there is enough time to carry out a plan before the world changes. &amp;nbsp;In other words, this approach is highly &lt;i&gt;deliberative&lt;/i&gt;. &amp;nbsp;Obviously, the world is highly dynamic, sensor readings are sometimes&amp;nbsp;erroneous, and time is sometimes of the&amp;nbsp;essence&amp;nbsp;when interacting with the world. &amp;nbsp;E.g., you probably wouldn&amp;#39;t want to spend much time creating an internal representation of the world if there&amp;#39;s a Mac truck speeding towards you.&lt;/p&gt;
&lt;p&gt;At the other extreme from deliberative is a &lt;i&gt;reactive &lt;/i&gt;approach to interacting with the world. &amp;nbsp;Taking a purely reactive approach does away with plans and internal representations of the world altogether; instead, a reactive approach focuses on using the world as its own model and reacts, accordingly. &amp;nbsp;Instead of plans, reactive approaches often rely upon &lt;a href="http://en.wikipedia.org/wiki/Finite-state_machine"&gt;finite state machines&lt;/a&gt; to modify behavior as the world changes. &amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Rodney_Brooks"&gt;Rodney Brooks&lt;/a&gt; changed robotics thinking upside down when he introduced this paradigm shift in the 80s. &amp;nbsp;The robots he and his team produced were much faster in their reaction times, when compared to deliberative robots, and exhibited surprisingly complex behavior, appearing quite intelligent in many scenarios. &amp;nbsp;But as is any extreme, a purely reactive approach to the world had it&amp;#39;s own drawbacks; its difficulty in managing complex scenarios which demand careful planning is one such example.&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="http://devlicio.us/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/billy_5F00_mccafferty/DeliberativeVsReactive.PNG" style="border:0;float:right;" alt="" /&gt;The&amp;nbsp;figure&amp;nbsp;at right illustrates some of the differences between deliberative and reactive systems. &amp;nbsp;Adapted from (Arkin, 1998).&lt;/p&gt;
&lt;p&gt;While there are certainly pros and cons to either approach, there are some scenarios which are appropriate to one or the other. &amp;nbsp;While still others may require more of a hybrid approach. &amp;nbsp;Let&amp;#39;s now take a look at each approach in more detail.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Deliberative/Hierarchical Style&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;One of the first successful architectural implementations on a mobile robotic platform was the well known robot known as &lt;a href="http://en.wikipedia.org/wiki/Shakey_the_robot"&gt;Shakey&lt;/a&gt;, created at Stanford University in the 1960s. &amp;nbsp;Of particular note was the robot&amp;#39;s architecture which was made up of three predominant layers: &amp;nbsp;a sensing layer, a planning layer, and an execution layer. &amp;nbsp;Accordingly, as information would be made available by sensors, Shakey would make plans on how to react to the perceived world and send those plans on to the execution layer for low level control of actuators. &amp;nbsp;This began the architectural paradigm known as &lt;i&gt;sense-plan-act (SPA)&lt;/i&gt;. &amp;nbsp;As the SPA approach matured, additional layers were introduced in a hierarchical style, typically all of which having access to a global world model. &amp;nbsp;The upper layers in the hierarchy would use the world model to make plans reaching into the future. &amp;nbsp;After plan development completed at the highest levels, the plans would be broken down into smaller commands and passed to lower levels for execution. &amp;nbsp;Lower layers would then further decompose the commands into more actionable tasks which would ultimately be passed on to actuators at the lowest level. &amp;nbsp;In a hierarchical approach, the sensing layers participate in keeping the internal representation of the world updated. &amp;nbsp;Furthermore, to better accommodate dynamic changes to the world environment, lower planning layers may suggest changes to plans based on recent changes to the world model.&lt;/p&gt;
&lt;p&gt;&lt;img style="border:0;float:right;" src="http://devlicio.us/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/billy_5F00_mccafferty/HierarchicalParadigm.PNG" border="0" alt="" /&gt;The diagram at right roughly illustrates this hierarchical architectural approach. &amp;nbsp;As should be noted, the sensing layers update the world model while a hierarchy of planning and execution layers formulate plans and breaks those plans down into actionable tasks. &amp;nbsp;Adapted from (Kortenkamp, 1998).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/billy_5F00_mccafferty/HierarchicalParadigm.PNG"&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;i&gt;4D/RCS&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;The current pinnacle of hierarchical architectures may be found in the reference architecture known as &lt;a href="http://www.isd.mel.nist.gov/documents/albus/4DRCS_ver2.pdf"&gt;4D/RCS (4 Dimensional / Real-time Control System)&lt;/a&gt;. &amp;nbsp;4D/RCS is the latest version of the RCS reference model architecture for intelligent systems that has been evolving for decades. &amp;nbsp;With 4D/RCS, six (more or less) layers are defined for creating and decomposing plans into low level action:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Unit/Vehicle/Mission Layer: &amp;nbsp;this layer decomposes the overall plan into actions for individual modules.&amp;nbsp;&amp;nbsp;Plans are regenerated every 2 hours to account for changes to the world model.&lt;/li&gt;
&lt;li&gt;Module Layer: &amp;nbsp;converts actions into tasks to be performed on specific objects and schedules the tasks, accordingly.&amp;nbsp;&amp;nbsp;Plans are regenerated every 10 minutes.&lt;/li&gt;
&lt;li&gt;Task Layer: &amp;nbsp;converts actions on a single object into sequences of moves to carry out the action.&amp;nbsp;&amp;nbsp;Plans are regenerated every minute.&lt;/li&gt;
&lt;li&gt;Elemental Layer: &amp;nbsp;creates plans for each move, avoiding obstacles and collisions. &amp;nbsp;Plans are regenerated every 5 seconds.&lt;/li&gt;
&lt;li&gt;Primitive Layer: &amp;nbsp;determines motion primitives (speed, trajectory) to facilitate smooth movement. &amp;nbsp;Plans are&amp;nbsp;regenerated&amp;nbsp;every 0.5 second.&lt;/li&gt;
&lt;li&gt;Servo Layer: &amp;nbsp;sends servo control commands (velocity, force) to actuators. &amp;nbsp;Plans are&amp;nbsp;regenerated&amp;nbsp;every 0.05 seconds.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;At the heart of each and every layer are one or more 4D/RCS nodes which contain a behavior generation process which accepts commands from the next higher level and issues subgoals to the behavior generation process at lower levels. &amp;nbsp;Furthermore, each node reports its task execution status up the chain for consideration into further planning. &amp;nbsp;While plans are being solidified and disseminated, a sensory processing process in each node receives sensory input from lower levels, updates the world model, and collates the sensory data into larger units which it passes on to the next higher level; e.g., points get converted to lines which get converted to surfaces which get converted to objects with each successive rise through the 4D/RCS layers &amp;nbsp;A &lt;a href="http://upload.wikimedia.org/wikipedia/commons/c/c6/RCS_NODE_Internal_structure.jpg"&gt;visual summary of a 4D/RCS node&lt;/a&gt; quickly shows just how complex such a system can become. &amp;nbsp;But sometimes the demands of a task require a respective amount of sophistication in the architectural approach. &amp;nbsp;&amp;nbsp;A comprehensive review of the 4D/RCS approach is discussed in (Albus, 2006).&lt;/p&gt;
&lt;p&gt;The primary advantage to deliberative, hierarchical approaches such as 4D/RCS is that competent plans for managing complex scenarios can be generated and broken down into smaller chunks for lower levels to execute. &amp;nbsp;But an obvious disadvantage to this comes in the form of much added complexity to the overall system while penalizing the speed at which the system can react to a changing environment.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Reactive Style&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In the 1980s, Rodney Brooks, in an effort to overcome some of the limitations of sense-plan-act that Shakey and other such robots exhibited, introduced the concept of reactive control. &amp;nbsp;&amp;quot;Simply put, reactive control is a technique for tightly coupling perception and action, typically in the context of motor behaviors, to produce timely robotic response in dynamic and unstructured worlds.&amp;quot; &amp;nbsp;(Arkin, 1998). &amp;nbsp;In other words, by eliminating the reliance on maintaining an internal world model and avoiding large amounts of time generating plans, simple responses can be executed in reaction to specific stimuli, thus exhibiting behavior similar to that of living organisms. &amp;nbsp;If there was any doubt in what Brooks was trying to imply, he boldly titled one of his works,&amp;nbsp;&lt;a href="http://people.csail.mit.edu/brooks/papers/Planning%20is%20Just.pdf"&gt;Planning is Just a Way of Avoiding Figuring Out What to do Next&lt;/a&gt;. &amp;nbsp;This paradigm shift away from planning turned sense-plan-act into a simpler&amp;nbsp;&lt;i&gt;sense-act&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;Accordingly, in a sense-act paradigm, the primary focus is in carefully defining behaviors and the environment stimulus which should invoke those behaviors. This focus is deeply rooted in the idea of &lt;a href="http://en.wikipedia.org/wiki/Behaviorism"&gt;behaviorism&lt;/a&gt;;&amp;nbsp;from a behaviorism perspective, behavior is defined in terms of stimulus and response by observing what an organism does. &amp;nbsp;This approach of developing robotics around such behaviors, unsurprisingly enough, is commonly referred to as&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Behavior-based_robotics"&gt;Behavior Based Robotics&lt;/a&gt;. &amp;nbsp;By leveraging simple state machines, which we&amp;#39;ll examine below, to define which behaviors are active for a given stimuli, the overall architectural complexity is greatly reduced while giving rise to responsive, seemingly intelligent behaviors. &amp;nbsp;(The question of whether or not the robot is truly intelligent and/or self-aware is a debate that I&amp;#39;ll leave to others such as &lt;a href="http://en.wikipedia.org/wiki/John_Searle"&gt;Searle&lt;/a&gt; and &lt;a href="http://en.wikipedia.org/wiki/Daniel_Dennett"&gt;Dennett&lt;/a&gt;.) &amp;nbsp;While the reactive approach took the spotlight for a number of years, and is still very appropriate in some cases, its limitations in managing complex scenarios and performing sophisticated planning indicated that this approach was not the end all panacea for all situations.&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="http://devlicio.us/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/billy_5F00_mccafferty/ReactiveParadigm.PNG" style="border:0;float:right;" alt="" /&gt;The diagram at right clarifies that reactive systems remove planning and deal with sensory input within the context of each behavior. &amp;nbsp;I.e., &amp;quot;Behavior 1&amp;quot; has no knowledge of the feedback coming from &amp;quot;Sensor 3.&amp;quot; &amp;nbsp;Adapted from (Kortenkamp, 1998).&lt;/p&gt;
&lt;p&gt;&lt;i&gt;A Design Methodology for Reactive Systems&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;Due to the simplistic nature of reactive systems, the corresponding design methodology for developing such systems is rather straight-forward (Kortenkamp, 1998):&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Choose the tasks to be performed. &amp;nbsp;E.g., find kitchen.&lt;/li&gt;
&lt;li&gt;Break down the tasks in terms of specific motor-behaviors necessary to accomplish each task. &amp;nbsp;E.g., find wall, follow wall, recognize kitchen.&lt;/li&gt;
&lt;li&gt;For each action, find a condition under which each action should be taken. &amp;nbsp;E.g., wall found.&lt;/li&gt;
&lt;li&gt;For each condition, find a set of perceptual measurements that are sufficient to determine the truth of the condition. &amp;nbsp;E.g., long straight line connected to obstacle.&lt;/li&gt;
&lt;li&gt;For each measurement, design a custom sensory process to compute it. &amp;nbsp;E.g., bumper sensor activated, edge length over threshold found.&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;When implemented, we find that the defined behaviors can be realized as states within a finite state machine and that found conditions act as the mechanism for changing from one behavior state to another. &amp;nbsp;What&amp;#39;s missing is an arbitration mechanism to determine which behavior wins out in light of competing conditions. &amp;nbsp;Let&amp;#39;s briefly look at implementation approaches to reactive systems along with how such arbitration is achieved.&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Subsumption &amp;amp;&amp;nbsp;&lt;span style="font-style:normal;"&gt;&lt;i&gt;Motor Schemas&lt;/i&gt;&lt;/span&gt;&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;A key concern with reactive, behavior based robotics is determining which behavior should take&amp;nbsp;precedence&amp;nbsp;if conditions exist to activate two or more behaviors. &amp;nbsp;An arbitration mechanism needs to be introduced to resolve such competing situation. &amp;nbsp;Brooks dealt with this issue by proposing an architecture known as &lt;/span&gt;&lt;a href="http://ai.eecs.umich.edu/cogarch0/subsump/"&gt;subsumption&lt;/a&gt;&lt;span&gt;. &amp;nbsp;Simply enough, a subsumption architecture still uses a finite state machine to codify behaviors and transitions, but introduces behavioral layers which can provide input to other layers and override behaviors of lower layers. &amp;nbsp;The advantage is in facilitating more sophisticated behaviors as a sum of &amp;quot;lesser&amp;quot; behaviors. &amp;nbsp;It&amp;#39;s better understood by reviewing the following example from (Arkin, 1998):&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;img src="http://devlicio.us/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/billy_5F00_mccafferty/BehaviorBasedArchitectureExample.gif" border="0" alt="" /&gt;&lt;br /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;In the example, there are three behavioral layers: &amp;nbsp;Avoid-Objects, Explore, and Back-Out-of-Tight-Situations. &amp;nbsp;The Avoid-Objects Layer&amp;#39;s responsibility is to avoid objects by moving away from any perceived obstacles. &amp;nbsp;The Explore Layer&amp;#39;s responsibility is to cover large areas of space in the absence of obstacles. &amp;nbsp;The highest level assists the robot in getting out of tight spaces if the lower layers are unable to do so. &amp;nbsp;Each discrete behavior can invoke transitions to other behaviors and/or provide input or advice to subsequent behaviors based on perceived conditions. &amp;nbsp;The &amp;quot;trick&amp;quot; of subsumption is that higher levels can suppress commands between lower level behaviors; consequently, higher layers are able to handle more complex scenarios by manipulating lower level behaviors in addition to its own. &amp;nbsp;To illustrate suppression, note, in the above example that the &amp;quot;Reverse&amp;quot; behavior in the&amp;nbsp;Back-Out-of-Tight-Situations Layer suppresses any commands that the &amp;quot;Forward&amp;quot; behavior is sending to the actuators. &amp;nbsp;By doing so, complex behaviors may emerge using a number of basic behaviors and a relatively simple architectural approach.&lt;/p&gt;
&lt;p&gt;A major challenge in using a subsumption architecture is deciding the appropriate hierarchy of behavioral layers. &amp;nbsp;In more complex scenarios, it quickly gets sticky deciding which layer should have the right to suppress which other layers. &amp;nbsp;(Otherwise known as spaghetti-prone.) &amp;nbsp;Additionally, since the layers have bi-directional dependencies amongst each other, in order to provide input and suppression, changes to layers can have large impacts on other layers, often resulting in shotgun surgery with any change. &amp;nbsp;Ronald Arkin introduced a subsequent architecture to address these, and other concerns, with an approach known as Motor-Schema based control which does away with arbitrating competing behaviors. &amp;nbsp;Each active behavior in a Motor-Schema based control system calculates a vector to be carried out by an actuator (e.g., wheels or arm). &amp;nbsp;Using vector addition, a final vector for each actuator is computed and sent for execution. &amp;nbsp;With this approach, the output of behaviors is combined instead of arbitrated. &amp;nbsp;This avoids the need to determine suppression hierarchies and makes a more extensible application, within the limits of behavior based robotics.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Hybrid Style&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;img border="0" src="http://devlicio.us/resized-image.ashx/__size/550x0/__key/CommunityServer.Blogs.Components.WeblogFiles/billy_5F00_mccafferty/HybridParadigm.PNG" style="border:0;float:right;" alt="" /&gt;Most modern architectural approaches to robotics control attempt to combine the planning capabilities of deliberative systems with the responsiveness of reactive systems. &amp;nbsp;Appropriately enough, this is referred to as a hybrid style. &amp;nbsp;While the deliberative approach takes a sense-plan-act perspective and the reactive approach follows with plan-act, a hybrid approach typically takes the form of &lt;i&gt;plan, sense-act&lt;/i&gt;. &amp;nbsp;So while the sense-act layers carry out behaviors, the deliberative planning layer can observe the progress of reactive behaviors and suggest direction based on reasoning, planning and problem-solving. &amp;nbsp;The diagram at right crudely demonstrates this combination of the two approaches. &amp;nbsp;Adapted from (Kortenkamp, 1998).&lt;/p&gt;
&lt;p&gt;&lt;i&gt;Three-Layer Architecture (3T)&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;James Firby&amp;#39;s thesis proposing Reactive Action Packages (RAPs) (Firby, 1989) provided a solid approach for integrating deliberative planning with reactive behaviors in the form of a three layer architecture. &amp;nbsp;A multitude of subsequent architectures have emulated a similar approach, coming to be known as 3T architecture. &amp;nbsp;From Eran Gat&amp;#39;s essay &lt;i&gt;Three Layer Architecture&lt;/i&gt;&amp;nbsp;(Kortenkamp, 1998):&lt;/p&gt;
&lt;blockquote&gt;Three-layer architectures organize algorithms according to whether they contain no state, contain state&amp;nbsp;reflecting&amp;nbsp;memories about the past, or contain state&amp;nbsp;reflecting&amp;nbsp;predictions about the future. &amp;nbsp;Stateless sensor-based algorithms inhabit the control component. &amp;nbsp;Algorithms that contain memory about the past inhabit the sequencer. &amp;nbsp;Algorithms that make predictions about the future inhabit the deliberator. ... In 3T the components are called the &lt;i&gt;skill layer&lt;/i&gt;, the &lt;i&gt;sequencing layer&lt;/i&gt;, and the &lt;i&gt;planning [deliberative] layer&lt;/i&gt;.&lt;/blockquote&gt;
&lt;p&gt;As implied by being a hybrid approach, this 3T architecture is not mutually exclusive to behavior driven robotics. &amp;nbsp;Indeed, the skill layer itself is made up of unique behaviors which resemble that of reactive systems. &amp;nbsp;The sequencing layer then uses the world model to determine when a change in behavior is required. &amp;nbsp;The planning layer can then monitor the lower layers and perform more deliberative, time consuming processes such as path planning. &amp;nbsp;The primary variation amongst 3T implementations lies in the decision between whether the planning layer &amp;quot;runs the show&amp;quot; or if the sequencing layer takes command and invokes the planning layer only when needed. &amp;nbsp;&lt;a href="http://ai.eecs.umich.edu/cogarch3/Gat/Gat.html"&gt;Atlantis&lt;/a&gt; is one such example that leaves primary control to the sequencing layer to invoke the planning layer. &amp;nbsp;Other examples of 3T implementations include Bonasso&amp;#39;s &lt;i&gt;&lt;a href="http://dli.iiit.ac.in/ijcai/IJCAI-91-VOL2/PDF/089.pdf"&gt;Integrating Reaction Plans and Layered Competences through Synchronous Control&lt;/a&gt;&lt;/i&gt;&amp;nbsp;and &lt;a href="http://cs.stanford.edu/people/petrovsk/dn/publications/montemerlo_fsr08.pdf"&gt;Standford&amp;#39;s Junior&lt;/a&gt; which took 2nd place in &lt;a href="http://www.darpa.mil/grandchallenge/index.asp"&gt;Darpa&amp;#39;s Urban Challenge&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Wrapping Up&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The intention of this article has been to provide an introductory overview of paradigms of robotic control including deliberative/hierarchical systems, reactive systems, and hybrid systems. &amp;nbsp;While each approach is appropriate in select contexts, a hybrid&amp;nbsp;architecture&amp;nbsp;is very adaptable for accommodating a large variety of robotic control scenarios with sufficient planning and reactive capabilities. &amp;nbsp;The interested reader is encouraged to dig further into the references and links provided to learn more about these various approaches and design methodologies for implementation.&lt;/p&gt;
&lt;p&gt;In the next post, we will examine messaging strategies to facilitate the communications amongst the layers and components of robotic systems.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;References&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;Albus, J., Madhavan, R., Messina, E. &amp;nbsp;2006. &amp;nbsp;&lt;a href="http://www.amazon.com/Intelligent-Vehicle-Systems-RCS-Approach/dp/1600212603"&gt;Intelligent Vehicle Systems: A 4D/RCS Approach&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Arkin, R. &amp;nbsp;1998. &amp;nbsp;&lt;a href="http://www.amazon.com/Behavior-Based-Robotics-Intelligent-Autonomous-Agents/dp/0262011654"&gt;Behavior Based Robotics&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Firby, J. &amp;nbsp;1989. &amp;nbsp;&lt;a href="http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.17.9&amp;amp;rep=rep1&amp;amp;type=pdf"&gt;Adaptive Execution in Complex Dynamic Worlds&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Kortenkamp, D., Bonasso, R., Murphy, R. &amp;nbsp;1998. &amp;nbsp;&lt;a href="http://www.amazon.com/Artificial-Intelligence-Mobile-Robots-Successful/dp/0262611376"&gt;Artificial Intelligence and Mobile Robots&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55261" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/o9zDh8DII1s" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/billy_mccafferty/archive/tags/Architecture/default.aspx">Architecture</category><category domain="http://devlicio.us/blogs/billy_mccafferty/archive/tags/Robotics/default.aspx">Robotics</category><feedburner:origLink>http://devlicio.us/blogs/billy_mccafferty/archive/2010/02/03/software-architectural-approaches-for-robotics.aspx</feedburner:origLink></item><item><title>Real World S#arp Architecture</title><link>http://feedproxy.google.com/~r/Devlicious/~3/VWUKFGS9_JM/using-s-arp-architecture-in-the-real-world.aspx</link><pubDate>Wed, 03 Feb 2010 21:04:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55260</guid><dc:creator>Billy McCafferty</dc:creator><slash:comments>11</slash:comments><description>&lt;p&gt;With any framework, technology, tutorial, book, idea, &amp;lt;insert pedagogical sources here&amp;gt;, it&amp;#39;s often difficult to figure how the technique should be used in the real world. &amp;nbsp;Sure, things sound great when the scope of your project deals cleanly with Customers, Orders and Order Items; and sure, auto-binding works great in a nicely controlled scenarios...but how should things work in the &amp;quot;real world.&amp;quot; &amp;nbsp;No, not the Real World in which Brooke has a complete meltdown in season 18. &amp;nbsp;I&amp;#39;m talking about the real world in which many scenarios aren&amp;#39;t clean cut in determining where the controller should end and the application services layer should take over; the world in which you&amp;#39;re trying to bind from unique data collection mechanisms to appease odd requests from the client; the world in which even the GoF would retort with &amp;quot;heh, that&amp;#39;s a tricky one.&amp;quot; &amp;nbsp;Yes, we&amp;#39;re faced with these kinds of dilemmas on a frequent basis. &amp;nbsp;What I find to be truly helpful is to look at full blown, real-world applications. &amp;nbsp;While a real-world application is never perfect, you can often find great gems for dealing with tricky situations and using patterns and complex scenarios. &amp;nbsp;Howard van Rooijen has released just such a real-world application demonstrating the use of&amp;nbsp;&lt;a href="http://wiki.sharparchitecture.net/"&gt;S#arp Architecture&lt;/a&gt;,&amp;nbsp;&lt;a href="http://automapper.codeplex.com/"&gt;AutoMapper&lt;/a&gt;, &lt;a href="http://code.google.com/p/elmah/"&gt;ELMAH&lt;/a&gt;, &lt;a href="http://sparkviewengine.com/"&gt;Spark View Engine&lt;/a&gt;, and other great tools.&lt;/p&gt;
&lt;p&gt;In Howard&amp;#39;s own words... &amp;nbsp;&amp;quot;A few months ago I wrote an email to the community about a site we had just launched &amp;ndash; http://fancydressoutfitters.co.uk that used S#arp Architecture at its core along with a whole myriad of other Open Source Frameworks and Tools (Spark, AutoMapper, PostSharp, xVal...).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://whocanhelpme.codeplex.com/"&gt;&lt;img style="border:0;float:right;margin:4px;" border="0" src="http://who-can-help.me/Views/_Content/img/logo.png" width="400" alt="" /&gt;&lt;/a&gt;In the run up to the festive period, myself and two of the development team &amp;ndash; Jonathan George &amp;amp; James Broome, decided that in the spirit of giving, we wanted to gift something back to the communities that gave so much to us throughout the year; so we decided to build a new sample web application to showcase the use of these various frameworks &amp;amp; tools called &amp;ldquo;Who Can Help Me?&amp;rdquo; which is based on the same architectural style as http://fancydressoutfitters.co.uk.&lt;/p&gt;
&lt;p&gt;Who Can Help Me? started out as a small web application I built a few years ago to solve a small and specific business problem within our consulting organisation (and to test out .NET 3.5, LINQ to SQL, ASP.NET WebForms &amp;amp; MS AJAX!). The problem was, that as the organisation grew and new members of staff started, they found it difficult to find the right people who could help them solve specific problems they&amp;rsquo;d encounter in their consulting gigs. As I have worked for the organisation for a long time (&amp;gt;9 years) I generally knew everyone, had worked with most of them and knew what their areas of expertise were, thus I&amp;rsquo;d get a few calls every day asking &amp;ldquo;Do you know anyone who knows about X that could help me?&amp;rdquo;. The solution was to create a searchable skills matrix that would allow people within an organisation find other people who had specific skills or expertise who could help them solve a particular problem.&lt;/p&gt;
&lt;p&gt;So Jonathan, James &amp;amp; I decided to re-write the Who Can Help Me? from scratch, using the architecture style, frameworks and tools we used to build http://fancydressoutfitters.co.uk - it might seem like we&amp;#39;ve massively over-complicated the architecture for such a simple application - but we really wanted this to demonstrate some of the concepts &amp;amp; techniques we used to build a full scale, public facing enterprise web application.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Who Can Help Me? utilises the following:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://wiki.sharparchitecture.net/"&gt;S#arp Architecture&lt;/a&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.asp.net/(S(d35rmemuuono1wvm1gsp2n45))/mvc/"&gt;ASP.NET MVC&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeplex.com/MVCContrib"&gt;ASP.NET MVC Contrib&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.hibernate.org/343.html"&gt;NHibernate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://fluentnhibernate.org/"&gt;Fluent NHibernate&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.castleproject.org/container/index.html"&gt;Castle Windsor&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://automapper.codeplex.com/"&gt;AutoMapper&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeplex.com/csd"&gt;Configuration Section Designer&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.ohloh.net/p/dotnetopenauth"&gt;DotNetOpenAuth&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/elmah/"&gt;ELMAH&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.dotlesscss.com/"&gt;Less CSS for .NET&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://codebetter.com/blogs/aaron.jensen/archive/2008/05/08/introducing-machine-specifications-or-mspec-for-short.aspx"&gt;Machine.Specifications (MSpec) BDD Framework&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.codeplex.com/MEF"&gt;MEF&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.postsharp.org/"&gt;PostSharp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.ayende.com/projects/rhino-mocks.aspx"&gt;RhinoMocks&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://sparkviewengine.com/"&gt;Spark View Engine&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://tweetsharp.com/"&gt;TweetSharp&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://xval.codeplex.com/"&gt;xVal Validation Framework &amp;nbsp;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;The project is currently hosted at Codeplex: &lt;a href="http://whocanhelpme.codeplex.com/"&gt;http://whocanhelpme.codeplex.com/&lt;/a&gt; and we&amp;rsquo;ve also released a live demo: &lt;a href="http://who-can-help.me"&gt;http://who-can-help.me&lt;/a&gt;. &amp;nbsp;We&amp;rsquo;ve added some documentation on the Codeplex homepage and will continue to refine this and augment it with blog posts covering some topics in more depth &amp;ndash; so if you&amp;rsquo;re interested &amp;ndash; please keep an eye on the following blogs / twitter:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://howard.vanrooijen.co.uk/blog/"&gt;http://howard.vanrooijen.co.uk/blog/&lt;/a&gt; | @HowardvRooijen&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jonathangeorge.co.uk/"&gt;http://jonathangeorge.co.uk/&lt;/a&gt; | @jon_george1&lt;/li&gt;
&lt;li&gt;&lt;a href="http://jamesbroo.me/"&gt;http://jamesbroo.me/&lt;/a&gt; | @broomej&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Thanks very much for this contribution Howard! &amp;nbsp;Besides myself, I&amp;#39;m sure others have found this project helpful and will continue to do so in the future.&lt;/p&gt;
&lt;p&gt;Enjoy!&lt;/p&gt;
&lt;p&gt;Billy McCafferty&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55260" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/VWUKFGS9_JM" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/billy_mccafferty/archive/tags/S_2300_arp+Architecture/default.aspx">S#arp Architecture</category><feedburner:origLink>http://devlicio.us/blogs/billy_mccafferty/archive/2010/02/03/using-s-arp-architecture-in-the-real-world.aspx</feedburner:origLink></item><item><title>Learning in the Open: II – first relation and more ActiveRecord</title><link>http://feedproxy.google.com/~r/Devlicious/~3/nlKT8U5LP-U/learning-in-the-open-ii-first-relation-and-more-activerecord.aspx</link><pubDate>Tue, 02 Feb 2010 17:18:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55252</guid><dc:creator>Krzysztof Koźmic</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;It took a little longer than I planned but here we go again. In the meantime &lt;a href="http://mortslikeus.blogspot.com/2010/01/activerecord-21-released.html"&gt;ActiveRecord 2.1 was released&lt;/a&gt;, and soon after that a &lt;a href="http://groups.google.com/group/castle-project-users/browse_thread/thread/6b93a3a1ebf270ad"&gt;minor update bringing one cool big feature&lt;/a&gt;. From now on we&amp;rsquo;ll be working on &lt;a href="http://sourceforge.net/projects/castleproject/files/ActiveRecord/2.1/AR%202.1.2.zip/download"&gt;version 2.1.2&lt;/a&gt;. Picking up from where we left off &lt;a href="http://kozmic.pl/archive/2010/01/10/learning-in-the-open-i-ndash-starting-with-activerecord.aspx"&gt;last time&lt;/a&gt;. We have a user entity. Since we&amp;rsquo;re building a website where users can publish benchmark results, we&amp;rsquo;ll create now a benchmark entity, and create a relation between these two.&lt;/p&gt;
&lt;h3&gt;I want to see results!&lt;/h3&gt;
&lt;p&gt;Let&amp;rsquo;s start by adding an appropriate field to the User class:&lt;/p&gt;
&lt;div style="border:1px solid silver;text-align:left;padding:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;width:97.5%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;height:42px;max-height:550px;font-size:8pt;overflow:auto;cursor:text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;" id="codeSnippet"&gt;
&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;readonly&lt;/span&gt; ICollection&amp;lt;BenchmarkResult&amp;gt; benchmarkResults = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; HashSet&amp;lt;BenchmarkResult&amp;gt;();&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;We also create a property:&lt;/p&gt;
&lt;div style="border:1px solid silver;text-align:left;padding:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;width:97.5%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;max-height:550px;font-size:8pt;overflow:auto;cursor:text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;" id="codeSnippet"&gt;
&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; IEnumerable&amp;lt;BenchmarkResult&amp;gt; BenchmarkResults&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;{&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    get&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    {&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        &lt;span style="color:#0000ff;"&gt;foreach&lt;/span&gt; (var result &lt;span style="color:#0000ff;"&gt;in&lt;/span&gt; benchmarkResults)&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        {&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;            &lt;span style="color:#0000ff;"&gt;yield&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; result;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        }&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    }&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;So far this is just a regular property. To map it as a one-to-many relation we use the &lt;i&gt;HasManyAttribute&lt;/i&gt;.&lt;/p&gt;
&lt;div style="border:1px solid silver;text-align:left;padding:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;width:97.5%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;max-height:550px;font-size:8pt;overflow:auto;cursor:text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;" id="codeSnippet"&gt;
&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;[HasMany(Access = PropertyAccess.FieldCamelcase, &lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    Cascade = ManyRelationCascadeEnum.SaveUpdate, &lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    RelationType = RelationType.Set,&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    Inverse = &lt;span style="color:#0000ff;"&gt;true&lt;/span&gt;)]&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; IEnumerable&amp;lt;BenchmarkResult&amp;gt; BenchmarkResults&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s quite a lot going on here, so let&amp;rsquo;s go over it piece by piece&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Access property FieldCamelcase specify we want ActiveRecord (and NHibernate underneath it) to go to the field directly, which makes sense since we&amp;rsquo;re exposing it as mere enumerable. &lt;/li&gt;
&lt;li&gt;Cascade specifies that when saving or updating our user, all new and changed benchmark results in the collection should also be appropriately saved or updated. &lt;/li&gt;
&lt;li&gt;Usually we wouldn&amp;rsquo;t have to specify type of the relation. Usually it will infer it from the kind of collection we expose, and would use set for ISet, map for IDictionary, bag for ICollection etc. However since we&amp;rsquo;re exposing only IEnumerable it does not have enough information to decide, that&amp;rsquo;s why we have to be explicit here. &lt;/li&gt;
&lt;li&gt;We also specify Inverse property to be true, which basically means that it&amp;rsquo;s child&amp;rsquo;s task to maintain the relationship. That also means that &lt;a href="http://jonathan-oliver.blogspot.com/2009/09/nhibernate-inverse-and-object.html"&gt;child needs to have a reference to the parent&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Let&amp;rsquo;s now build our &lt;i&gt;BenchmarkResult&lt;/i&gt; class.&lt;/p&gt;
&lt;div style="border:1px solid silver;text-align:left;padding:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;width:97.5%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;max-height:550px;font-size:8pt;overflow:auto;cursor:text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;" id="codeSnippet"&gt;
&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;[ActiveRecord]&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; BenchmarkResult : ActiveRecordLinqBase&amp;lt;BenchmarkResult&amp;gt;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;{&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    &lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; BenchmarkResult()&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    {&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    }&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; BenchmarkResult(User user, &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; benmchmarkName, &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; computerModel, &lt;span style="color:#0000ff;"&gt;double&lt;/span&gt; score)&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    {&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (user == &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        {&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;            &lt;span style="color:#0000ff;"&gt;throw&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#006080;"&gt;&amp;quot;user&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        }&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (benmchmarkName == &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        {&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;            &lt;span style="color:#0000ff;"&gt;throw&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#006080;"&gt;&amp;quot;benmchmarkName&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        }&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        &lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (computerModel == &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;)&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        {&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;            &lt;span style="color:#0000ff;"&gt;throw&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; ArgumentNullException(&lt;span style="color:#006080;"&gt;&amp;quot;computerModel&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        }&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        User = user;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        BenmchmarkName = benmchmarkName;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        ComputerModel = computerModel;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        Score = score;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    }&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;So far there&amp;rsquo;s nothing new here. Computer configuration and benchmark will become entities themselves soon, but let&amp;rsquo;s not get ahead of ourselves.&lt;/p&gt;
&lt;p&gt;The only interesting property at this point is the &lt;i&gt;User&lt;/i&gt;.&lt;/p&gt;
&lt;div style="border:1px solid silver;text-align:left;padding:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;width:97.5%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;max-height:550px;font-size:8pt;overflow:auto;cursor:text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;" id="codeSnippet"&gt;
&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;[BelongsTo]&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; User User { get; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; set; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It has a BelongsToAttribute to denote it points to another entity (on our case the &amp;lsquo;one&amp;rsquo; end of our one-to-many).&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s now let our users to actually save benchmark results, and we&amp;rsquo;re more or less done:&lt;/p&gt;
&lt;div style="border:1px solid silver;text-align:left;padding:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;width:97.5%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;max-height:550px;font-size:8pt;overflow:auto;cursor:text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;" id="codeSnippet"&gt;
&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; BenchmarkResult RunBenchmark(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; benchmarkName, &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; computerModel, &lt;span style="color:#0000ff;"&gt;double&lt;/span&gt; score)&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;{&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    var result = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; BenchmarkResult(&lt;span style="color:#0000ff;"&gt;this&lt;/span&gt;, benchmarkName, computerModel, score);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    benchmarkResults.Add(result);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; result;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h3&gt;&lt;/h3&gt;
&lt;h3&gt;Test&lt;/h3&gt;
&lt;p&gt;We now have all the logic in place, so let&amp;rsquo;s build a test:&lt;/p&gt;
&lt;div style="border:1px solid silver;text-align:left;padding:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;width:97.5%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;max-height:550px;font-size:8pt;overflow:auto;cursor:text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;" id="codeSnippet"&gt;
&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;[Fact]&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Can_perform_benchmark_runs()&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;{&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    var stefan = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; User&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    {&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        Email = &lt;span style="color:#006080;"&gt;&amp;quot;stefan@gmail.com&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        Name = &lt;span style="color:#006080;"&gt;&amp;quot;Stefan&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        Password = &lt;span style="color:#006080;"&gt;&amp;quot;Super compilcated password!&amp;quot;&lt;/span&gt;,&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;        About = &lt;span style="color:#006080;"&gt;&amp;quot;Stefan is a very cool.&amp;quot;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    };&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    stefan.RunBenchmark(&lt;span style="color:#006080;"&gt;&amp;quot;Foo bar!&amp;quot;&lt;/span&gt;, &lt;span style="color:#006080;"&gt;&amp;quot;AyeMack Pro&amp;quot;&lt;/span&gt;, 3.2);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    stefan.Save();&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    var user = User.FindAll().Single();&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    Assert.NotEmpty(user.BenchmarkResults);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    Assert.Equal(1, user.BenchmarkResults.Count());&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    var result = user.BenchmarkResults.Single();&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&amp;nbsp;&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    Assert.NotNull(result);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    Assert.Equal(&lt;span style="color:#006080;"&gt;&amp;quot;Foo bar!&amp;quot;&lt;/span&gt;, result.BenmchmarkName);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    Assert.Equal(&lt;span style="color:#006080;"&gt;&amp;quot;AyeMack Pro&amp;quot;&lt;/span&gt;, result.ComputerModel);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;    Assert.Equal(3.2, result.Score);&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;}&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;If we run it now, it will fail. Good news is, that it does not have anything to do directly with our logic. Bad news is, that we have a passing test nonetheless, so let&amp;rsquo;s have a look at it.&lt;/p&gt;
&lt;h3&gt;Error&lt;/h3&gt;
&lt;p&gt;We get &amp;ldquo;Incorrect syntax near the keyword &amp;#39;User&amp;#39;.&amp;rdquo; error message. Here&amp;rsquo;s the SQL that was sent to the database:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/krzysztof_5F00_kozmic/error_5F00_sql_5F00_28DF102A.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="error_sql" alt="error_sql" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/krzysztof_5F00_kozmic/error_5F00_sql_5F00_thumb_5F00_5CA9972C.png" border="0" height="189" width="456" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Looks good doesn&amp;rsquo;t it? Well not &amp;ndash; really, User is a SQL Server keyword, as we can&amp;rsquo;t just use it as identifier &amp;ndash; we have to escape it. To do it, we have to specify the column name explicitly, and escape it by enclosing it within two ` characters (located above tab key on my keyboard).&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Yes I&amp;rsquo;m aware of hbm2ddl.keywords auto-quote. However I had some issues getting it to work with ActiveRecord. Any help doing this will be appreciated.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;div style="border:1px solid silver;text-align:left;padding:4px;line-height:12pt;background-color:#f4f4f4;margin:20px 0px 10px;width:97.5%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;max-height:550px;font-size:8pt;overflow:auto;cursor:text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;" id="codeSnippet"&gt;
&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:white;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;[BelongsTo(Column = &lt;span style="color:#006080;"&gt;&amp;quot;`User`&amp;quot;&lt;/span&gt;)]&lt;/pre&gt;

&lt;pre style="border-style:none;text-align:left;padding:0px;line-height:12pt;background-color:#f4f4f4;margin:0em;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;overflow:visible;"&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; User User { get; &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; set; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now the test will pass, and the following SQL will be generated:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/krzysztof_5F00_kozmic/ok_5F00_sql_5F00_1B9DA879.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="ok_sql" alt="ok_sql" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/krzysztof_5F00_kozmic/ok_5F00_sql_5F00_thumb_5F00_0F9E48F6.png" border="0" height="188" width="455" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now that we have the correct SQL, let&amp;rsquo;s look at what our schema looks like:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/krzysztof_5F00_kozmic/schema_5F00_inverse_5F00_true_5F00_50CEE2FE.png"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="schema_inverse_true" alt="schema_inverse_true" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/krzysztof_5F00_kozmic/schema_5F00_inverse_5F00_true_5F00_thumb_5F00_56AEA7F9.png" border="0" height="326" width="544" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55252" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/nlKT8U5LP-U" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/krzysztof_kozmic/archive/tags/Castle/default.aspx">Castle</category><feedburner:origLink>http://devlicio.us/blogs/krzysztof_kozmic/archive/2010/02/02/learning-in-the-open-ii-first-relation-and-more-activerecord.aspx</feedburner:origLink></item><item><title>Your First S#arp Project in 15 Minutes</title><link>http://feedproxy.google.com/~r/Devlicious/~3/mwauWsRqYYI/your-first-s-arp-project-in-10-minutes.aspx</link><pubDate>Mon, 01 Feb 2010 23:11:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55243</guid><dc:creator>Billy McCafferty</dc:creator><slash:comments>7</slash:comments><description>&lt;p&gt;The most daunting task when trying out or learning a new framework or technology is figuring out where the heck to start. &amp;nbsp;Take &lt;a href="http://wiki.sharparchitecture.net"&gt;S#arp Architecture&lt;/a&gt; for instance (arguably, the world&amp;#39;s most insanely amazing framework ever written by mankind...more or less). &amp;nbsp;As incredibly cool as S#arp is, it can be intimidating trying to figure out where to start. &amp;nbsp;To make that first step a bit easier, the following will get you up and running with your first S#arp project in about 15 minutes or less. &amp;nbsp;(Steps verified on WinXP Pro.)&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s what you&amp;#39;ll have in less than 15 minutes:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;A new S#arp Architecture project generated using a VS template,&lt;/li&gt;
&lt;li&gt;CRUD pages for managing product categories for our crazy cool store,&lt;/li&gt;
&lt;li&gt;live communications with the application database,&lt;/li&gt;
&lt;li&gt;and unit tests verifying that everything is working.&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Ready?&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Download S#arp Architecture and Generate Your Project&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Download and unzip the latest release at &lt;a href="http://cloud.github.com/downloads/codai/Sharp-Architecture/SharpArchitecture_1.0_2009_Q3.zip"&gt;http://cloud.github.com/downloads/codai/Sharp-Architecture/SharpArchitecture_1.0_2009_Q3.zip&lt;/a&gt;. &amp;nbsp;We&amp;#39;ll call the unzip location &amp;lt;ROOT&amp;gt;.&lt;/li&gt;
&lt;li&gt;Close all running instances of VS 2008.&lt;/li&gt;
&lt;li&gt;Install &amp;lt;ROOT&amp;gt;\tools\T4 Toolbox 9.5.20.1.msi. &amp;nbsp;(You&amp;#39;ll need to uninstall any existing version before doing so (not compatible with latest T4 Toolbox...yet.)&lt;/li&gt;
&lt;li&gt;Install &amp;lt;ROOT&amp;gt;\tools\NUnit-2.5.2.9222.msi. &amp;nbsp;(It&amp;#39;s likely compatible with later versions of NUnit as well.)&lt;/li&gt;
&lt;li&gt;Copy &amp;lt;ROOT&amp;gt;\VisualStudioTemplate\SharpArchApplicationTemplate.zip to &amp;quot;C:\Documents and Settings\&amp;lt;YOUR USERNAME&amp;gt;\My Documents\Visual Studio 2008\Templates\ProjectTemplates\Visual C#\Web&amp;quot; &amp;nbsp;(You&amp;#39;ll need to create the \Web folder. &amp;nbsp;Also, be sure to &lt;i&gt;copy&lt;/i&gt; the zip, don&amp;#39;t unzip it!)&lt;/li&gt;
&lt;li&gt;Copy&amp;nbsp;&amp;lt;ROOT&amp;gt;\VisualStudioTemplate\SharpArchApplicationWizard.dll to &amp;quot;C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE&amp;quot;&lt;/li&gt;
&lt;li&gt;Open VS 2008 and select File / New Project / Visual C# / Web / S#arp Architecture Application. &amp;nbsp;For the name, enter &amp;quot;MyCoolStore&amp;quot; (no spaces!), set the location to whatever you&amp;#39;d like (e.g., &amp;quot;C:\MyStuff\Projects\&amp;quot;), and keep &amp;quot;Create directory for solution&amp;quot; unchecked. &amp;nbsp;Then click OK. &amp;nbsp;(It&amp;#39;ll take about a minute to generate the solution...when the status changes back to &amp;quot;Ready&amp;quot; in the very bottom left of VS, you&amp;#39;re good to go.)&lt;/li&gt;
&lt;li&gt;Build the solution (should build without a problem).&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Hook Up to a Database&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Run NUnit and select File / Open Project, to then open &amp;lt;ROOT&amp;gt;/MyCoolStore/tests/MyCoolStore.Tests/bin/Debug/MyCoolStore.Tests.dll&lt;/li&gt;
&lt;li&gt;Run the tests and &lt;strong&gt;see the Data tests fail&lt;/strong&gt; due to a DB connection timeout. &amp;nbsp;Time to create the database!&lt;/li&gt;
&lt;li&gt;Create a new SQL Server database called MyCoolStore. &amp;nbsp;(Other DBs are &lt;a href="https://www.hibernate.org/361.html"&gt;supported&lt;/a&gt;.)&lt;/li&gt;
&lt;li&gt;In VS 2008, open MyCoolStore.Web/NHibernate.config and modify the following bits in the DB connection string: &amp;nbsp;YOUR_SERVER, YOUR_USERNAME and YOUR_PASSWORD. &amp;nbsp;Save the file.&lt;/li&gt;
&lt;li&gt;In NUnit, run the tests to &lt;strong&gt;see all the tests pass&lt;/strong&gt;...if all is green, your project is talking to the database. &amp;nbsp;(If the tests under Data still fail, recheck your DB connection string.)&lt;/li&gt;
&lt;li&gt;In VS 2008, right click the MyCoolStore.Web project and &amp;quot;Set as Startup Project&amp;quot; and click F5 after doing so to run the project. &amp;nbsp;(Not much to see here yet beyond the landing page...let&amp;#39;s add some CRUD functionality.)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Generate CRUD Scaffolding&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;After verifying that the web project is running, stop the debugger.&lt;/li&gt;
&lt;li&gt;In VS 2008, open Code Generation/CrudScaffolding/ScaffoldingGeneratorCommand.tt and do the following:
&lt;ul&gt;
&lt;li&gt;Change line 19 to:&lt;br /&gt;
&lt;pre name="code" class="c-sharp"&gt;new EntityScaffoldingDetails(&amp;quot;ProductCategory&amp;quot;);&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Delete the four additions to entityScaffoldingDetails, lines 25-36, and replace them with:&lt;br /&gt;
&lt;pre name="code" class="c-sharp"&gt;entityScaffoldingDetails.EntityProperties.Add(
   new EntityProperty(&amp;quot;Name&amp;quot;, &amp;quot;string&amp;quot;, 
      &amp;quot;Seafood&amp;quot;, &amp;quot;[NotNull, NotEmpty]&amp;quot;, true)
);&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Uncomment the 2nd to last line (i.e., remove the &amp;quot;//&amp;quot; in front of &lt;code&gt;generator.Run()&lt;/code&gt;) and save the file...&lt;/li&gt;
&lt;li&gt;&lt;i&gt;The CRUD scaffolding generator will run for a few seconds...it&amp;#39;ll be done when the cursor no longer looks like an hour glass. &amp;nbsp;(Yes, that&amp;#39;s annoying that it runs when the file is saved...that&amp;#39;s T4.)&lt;/i&gt;&lt;/li&gt;
&lt;li&gt;Recomment out the 2nd to last line (i.e., add the &amp;quot;//&amp;quot; in front of &lt;code&gt;generator.Run()&lt;/code&gt; back in) and save the file. &amp;nbsp;(This avoids premature generation - always embarrassing - when editing this file in the future.)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;In VS, rebuild the solution.&lt;/li&gt;
&lt;li&gt;In NUnit, run all of the tests...only CanConfirmDatabaseMatchesMappings should fail. &amp;nbsp;Time to add the ProductCategories table!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Create the Database Table&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In NUnit, run just Tests/MyCoolStore/Data/NHibernateMaps/MappingIntegrationTests/CanGenerateDatabaseSchema (which should pass), and change the NUnit tab to &amp;quot;Text Output.&amp;quot;&lt;/li&gt;
&lt;li&gt;Copy all of the SQL that you see on the Text Output tab in NUnit and run it against the MyCoolStore database using SQL Management Studio.&lt;/li&gt;
&lt;li&gt;In NUnit, run all of the tests again to see them pass.&lt;/li&gt;
&lt;li&gt;In VS, click F5 to run the project and change the URL, after it loads, to &lt;a href="http://localhost&amp;lt;DEBUG%20PORT&amp;gt;"&gt;http://localhost:&amp;lt;DEBUG PORT&amp;gt;/ProductCategories&lt;/a&gt;. &amp;nbsp;You can now CRUD product categories to your heart&amp;#39;s content!&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;strong&gt;Enforce Object Uniqueness&lt;/strong&gt;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;Let&amp;#39;s say you now want to enforce name uniqueness...
&lt;ul&gt;
&lt;li&gt;In VS, open MyCoolStore.Core/ProductCategory.cs and add an attribute as:&lt;br /&gt;
&lt;pre name="code" class="c-sharp"&gt;[HasUniqueDomainSignature(
   Message=&amp;quot;Provide a unique name dag nabbit!&amp;quot;)]
public class ProductCategory : Entity
{
   ...&lt;/pre&gt;
&lt;/li&gt;
&lt;li&gt;Build the solution, F5 into debug mode, and try to add two product categories with the same name...go ahead, try it, I triple dog dare you.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;Wanna learn more? &amp;nbsp;Go to&amp;nbsp;&lt;a href="http://wiki.sharparchitecture.net/"&gt;http://wiki.sharparchitecture.net/&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;And for all you S#arp junkies out there...the next quarterly release is coming soon...and it&amp;#39;s going to have proper utilization of the application services layer during CRUD generation!&lt;/p&gt;
&lt;p&gt;Billy McCafferty&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55243" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/mwauWsRqYYI" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/billy_mccafferty/archive/tags/S_2300_arp+Architecture/default.aspx">S#arp Architecture</category><feedburner:origLink>http://devlicio.us/blogs/billy_mccafferty/archive/2010/02/01/your-first-s-arp-project-in-10-minutes.aspx</feedburner:origLink></item><item><title>Warmup – Getting Started</title><link>http://feedproxy.google.com/~r/Devlicious/~3/7w1D55AwrS8/warmup-getting-started.aspx</link><pubDate>Mon, 01 Feb 2010 14:25:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55241</guid><dc:creator>Rob Reynolds</dc:creator><slash:comments>0</slash:comments><description>&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;What if there was a tool out there that could let you specify a structure for a project (visual studio solution + everything else) and save you up to 3+ hours of work every time you started a new project?&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a target="_blank" href="http://github.com/drusellers/warmup"&gt;Warmup&lt;/a&gt; was an idea by &lt;a target="_blank" href="http://codebetter.com/blogs/dru.sellers/archive/2009/09/25/warmup.aspx"&gt;Dru Sellers&lt;/a&gt; to remove all of the setup work required every time you set up a new project. You know, create the solution, add projects, put in your references, etc. Then how about getting the infrastructure for your service/website/console set up as well with things like IoC, etc? What about patterns and other pet items that you put in any project?&lt;/p&gt;
&lt;p&gt;Yeah &amp;ndash; there&amp;rsquo;s an app for that. And it&amp;rsquo;s pretty simple to use. Plus you can change your templates when you have new ideas, so it&amp;rsquo;s totally rockstar! &lt;/p&gt;
&lt;p&gt;The first thing you do is to set up templates somewhere in source control (svn or git). Then you specify where that is to the configuration and what type of source control.&lt;/p&gt;
&lt;pre name="code" class="xml"&gt;&amp;lt;warmup
  sourceControlWarmupLocation=&amp;quot;git://github.com/ferventcoder/warmup-templates.git&amp;quot;
  sourceControlType=&amp;quot;git&amp;quot;
  /&amp;gt;&lt;/pre&gt;
&lt;p&gt;Then you run a simple command. If base was one of the folders below the directory above my source control, then that is what I would specify as the first argument.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;warmup.exe base &lt;em&gt;nameOfProject&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_3D2669E1.png"&gt;&lt;img height="209" width="243" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_5549D43C.png" alt="The base is a template" border="0" title="The base is a template" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I specify &lt;em&gt;nameofProject&lt;/em&gt;. That is what I want my project to be named when I am complete.&amp;nbsp; &lt;/p&gt;
&lt;h4&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;Templating&lt;/span&gt;&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;Let&amp;rsquo;s start by taking a look at the base template. The basic idea here is simple. Place &lt;strong&gt;__NAME__&lt;/strong&gt; everywhere you want to be replaced when running Warmup. In the same way &lt;a target="_blank" href="http://projectuppercut.org"&gt;UppercuT&lt;/a&gt; does token replacement with ConfigBuilder, DocBuilder, SqlBuilder, and DeployBuilder, Warmup does token replacement for an entire solution.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_66BA3514.png"&gt;&lt;img height="484" width="258" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_4AC9001C.png" alt="__NAME__ for replacement" border="0" title="__NAME__ for replacement" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;If we were to look at some of the files you would see the absolute depth of how naming really can be replaced. Let&amp;rsquo;s take a look at the solution though, that will hold quite a bit of meaning for you.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_156FC7EA.png"&gt;&lt;img height="378" width="338" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_6D5D18CA.png" alt="From Visual Studio - __NAME__ is everywhere" border="0" title="From Visual Studio - __NAME__ is everywhere" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now that we have our template all set up, we have one thing to do. Open our .sln file in Notepad and delete the first line (not sure what happens here, but this works). Microsoft should be on the first line when we are done.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_7337BC63.png"&gt;&lt;img height="145" width="244" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_127A6337.png" alt="__NAME__.sln first line must be deleted." border="0" title="__NAME__.sln first line must be deleted." style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;And now our template is all ready, so we check our changes into source. If we are using git, we need to push back to the repository we are looking at after we finish committing.&lt;/p&gt;
&lt;h4&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;Run Warmup&lt;/span&gt;&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;Now that we&amp;rsquo;ve seen our template, let&amp;rsquo;s run Warmup.&lt;/p&gt;
&lt;p&gt;Let&amp;rsquo;s call the new project &lt;strong&gt;Alpha&lt;/strong&gt;.&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;warmup.exe base Alpha&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This is the output: &lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Hardcore git cloning action to: C:\code\warmup\code_drop\warmup\Alpha &lt;br /&gt;Running: cmd&amp;nbsp; /c git clone git://github.com/ferventcoder/warmup-templates.git C:\code\warmup\code_drop\warmup\Alpha &lt;br /&gt;Initialized empty Git repository in C:/code/warmup/code_drop/warmup/Alpha/.git/ &lt;/p&gt;
&lt;p&gt;replacing tokens&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_74B8D877.png"&gt;&lt;img height="231" width="244" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_612B78D6.png" alt="image" border="0" title="image" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt;&amp;nbsp; &lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_4612A9C8.png"&gt;&lt;img height="244" width="222" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_102DB4AE.png" alt="__NAME__ is replaced with Alpha when running Warmup" border="0" title="__NAME__ is replaced with Alpha when running Warmup" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;This project already has &lt;a target="_blank" href="http://projectuppercut.org"&gt;UppercuT&lt;/a&gt;, &lt;a target="_blank" href="http://projectroundhouse.org"&gt;RoundhousE&lt;/a&gt;, and others already in it. Take a look at the lib folder:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_55660BD7.png"&gt;&lt;img height="244" width="182" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_42B11220.png" alt="All of my references are good" border="0" title="All of my references are good" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I open a command line and run build.bat.&amp;nbsp; I get a successful build with 31 passing tests! If I were to go to the code_drop folder, I&amp;rsquo;m all ready to deploy if I had my deployment framework already here. &lt;/p&gt;
&lt;p&gt;I can already run RoundhousE and create my database from here:&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_4C29D096.png"&gt;&lt;img height="173" width="244" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_2CD703F6.png" alt="Output from RoundhousE" border="0" title="Output from RoundhousE" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_0B0B2B65.png"&gt;&lt;img height="172" width="244" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/rob_5F00_reynolds/image_5F00_thumb_5F00_69AB85C8.png" alt="Database is created and we are ready to rock!" border="0" title="Database is created and we are ready to rock!" style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h4&gt;&lt;strong&gt;&lt;span style="text-decoration:underline;"&gt;Conclusion&lt;/span&gt;&lt;/strong&gt;&lt;/h4&gt;
&lt;p&gt;I have an entire structure that allows me to just concentrate on the stories at hand. Warmup may not be the best thing since sliced bread, but it&amp;rsquo;s going to save you oodles of time! If you know someone else that has created a template you want to use and it&amp;rsquo;s shared publicly, you can just edit the config file to point there. We have been using warmup for close to 3 months now and it saves us quite a bit of time. Plus we find more and more things we can put back into the templates to save us time. I believe this aspect of learning and growing your templates over time is the intention of warmup. Plus your template may not be the same as mine and that&amp;rsquo;s completely cool!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55241" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/7w1D55AwrS8" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/RoundhousE/default.aspx">RoundhousE</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/HowTo/default.aspx">HowTo</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/UppercuT/default.aspx">UppercuT</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/rob_reynolds/archive/tags/.NET/default.aspx">.NET</category><feedburner:origLink>http://devlicio.us/blogs/rob_reynolds/archive/2010/02/01/warmup-getting-started.aspx</feedburner:origLink></item><item><title>MEF and decrypting LoaderExceptions</title><link>http://feedproxy.google.com/~r/Devlicious/~3/2Vl9jAxHQPo/mef-and-decrypting-loaderexceptions.aspx</link><pubDate>Sun, 31 Jan 2010 14:51:02 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55224</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;Have you ever received the following exception while using &lt;a href="http://www.codeplex.com/MEF"&gt;MEF&lt;/a&gt;?&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;if you have received this error did you scratch your head and wonder ‘what the F does this mean’?&amp;#160; Well the long and short of it is this.&amp;#160; This means that while trying to load an &lt;a href="http://mef.codeplex.com/wikipage?title=Declaring%20Exports&amp;amp;referringTitle=Guide"&gt;Export&lt;/a&gt; there was a dependency which could not be found during reflection.&lt;/p&gt;  &lt;p&gt;The quick way to determine the cause of the error is to do as the image below shows:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/MEFException_5F00_54EB0696.png"&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="MEFException" border="0" alt="MEFException" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/derik_5F00_whittaker/MEFException_5F00_thumb_5F00_0B78B1DB.png" width="804" height="104" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;What I would suggest is to wrap your MEF logic inside of a try-catch and explicitly catch &lt;a href="http://msdn.microsoft.com/en-us/library/system.reflection.reflectiontypeloadexception.aspx"&gt;ReflectionTypeLoadException&lt;/a&gt;.&amp;#160; Inside of your catch add some logic as such (just a PoC, copy-paster beware).&lt;/p&gt;  &lt;pre class="C#" name="code"&gt;catch (ReflectionTypeLoadException tLException)
{
    var loaderMessages = new StringBuilder();
    loaderMessages.AppendLine(&amp;quot;While trying to load composable parts the follwing loader exceptions were found: &amp;quot;);
    foreach (var loaderException in tLException.LoaderExceptions)
    {
        loaderMessages.AppendLine(loaderException.Message);
    }

    // this is one of our custom exception types.
    throw new PluginLoadingException(loaderMessages.ToString(), tLException);
}&lt;/pre&gt;

&lt;p&gt;As you can see when you look at the LoaderExcpetions collections from my image above I had forgotten to reference AutoMapper in my plug-in and all hell broke lose (btw, no idea how this even compiled, but that is a different post).&lt;/p&gt;

&lt;p&gt;Hope this helps.&lt;/p&gt;

&lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55224" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/2Vl9jAxHQPo" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/HowTo/default.aspx">HowTo</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/MEF/default.aspx">MEF</category><feedburner:origLink>http://devlicio.us/blogs/derik_whittaker/archive/2010/01/31/mef-and-decrypting-loaderexceptions.aspx</feedburner:origLink></item><item><title>Transparently releasing components in Windsor</title><link>http://feedproxy.google.com/~r/Devlicious/~3/E731vfimEPY/transparently-releasing-components-in-windsor.aspx</link><pubDate>Wed, 27 Jan 2010 19:57:11 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55161</guid><dc:creator>Krzysztof Koźmic</dc:creator><slash:comments>5</slash:comments><description>&lt;blockquote&gt;   &lt;h2&gt;Disclaimer:&lt;/h2&gt;    &lt;p&gt;This post is about the idea, not about the implementation. The implementation is crippled, not thread safe, will work only in few scenarios and only if used properly. &lt;strong&gt;Do not copy and blindly use this code&lt;/strong&gt;.&lt;/p&gt; &lt;/blockquote&gt;  &lt;h3&gt;&lt;/h3&gt;  &lt;h3&gt;The problem&lt;/h3&gt;  &lt;p&gt;One of unique features of Windsor is that it manages the lifecycle of objects it creates for you. What this means (among other things) is that it will dispose all disposable objects it instantiates. However to do this, it has to keep a reference to these components. Also that means that in order to properly release the components you have to get hold of the container and once you’re done using the components – explicitly release them with the container.&lt;/p&gt;  &lt;p&gt;It may be not desirable from your perspective to do it like this. Ideally, you’d rather use your component, call Dispose and then have Windsor release the component. This is not quite possible, since there’s no way by which Windsor can be notified that your component was disposed. Or is there?&lt;/p&gt;  &lt;h3&gt;The idea&lt;/h3&gt;  &lt;p&gt;Since Dispose is an interface method and Windsor has quite powerful AOP capabilities, we can take advantage of that and intercept the call to Dispose and transparently release our component. Let’s build a disposable component first:&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;background-color:#f4f4f4;margin:20px 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:550px;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;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;interface&lt;/span&gt; IController : IDisposable&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:#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;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:#0000ff;"&gt;int&lt;/span&gt; DoSomething();&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:#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;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:#0000ff;"&gt;bool&lt;/span&gt; Disposed { get; set; }&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:#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;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;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;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; Controller : IController&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;{&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:#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;// notice it&amp;#39;s not virtual!&lt;/span&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;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Dispose()&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:#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;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;// some clean up logic here&lt;/span&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:#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;        Disposed = &lt;span style="color:#0000ff;"&gt;true&lt;/span&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;    }&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:#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;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:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;int&lt;/span&gt; DoSomething()&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:#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;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:#0000ff;"&gt;return&lt;/span&gt; 42;&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:#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;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;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;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; Disposed&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;    {&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:#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;        get; set;&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;    }&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:#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;/div&gt;
&lt;/div&gt;

&lt;p&gt;One important thing to notice about this code – Dispose is not implemented virtually. This will make our sample simpler since we won’t have to deal with recursion.&lt;/p&gt;

&lt;p&gt;Then we set up the stage:&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;background-color:#f4f4f4;margin:20px 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:550px;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;[TestFixture]&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:#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;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; TransparentReleasingTest&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;{&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:#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;private&lt;/span&gt; WindsorContainer container;&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;#160;&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:#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;    [SetUp]&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;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; SetUp()&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:#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;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;        container = &lt;span style="color:#0000ff;"&gt;new&lt;/span&gt; WindsorContainer();&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:#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;        container.Register(Component.For&amp;lt;ReleaseComponentInterceptor&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;        container.Register(Component.For&amp;lt;IController&amp;gt;().ImplementedBy&amp;lt;Controller&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:#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;                               .LifeStyle.Transient&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;                               .Interceptors&amp;lt;ReleaseComponentInterceptor&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:#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;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;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;    [TearDown]&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;    &lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; CleanUp()&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:#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;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;        container.Dispose();&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:#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;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;/div&gt;
&lt;/div&gt;

&lt;p&gt;&lt;/p&gt;

&lt;p&gt;We’ll discuss the ReleaseComponentInterceptor, which is the gist of this post, in a minute. Let’s first create a test:&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;background-color:#f4f4f4;margin:20px 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:550px;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;[Test]&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:#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;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Dispose_releases_component()&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;{&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:#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;    IController item;&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;    &lt;span style="color:#0000ff;"&gt;using&lt;/span&gt; (var controller = container.Resolve&amp;lt;IController&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:#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;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;        item = controller;&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:#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;        controller.DoSomething();&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;#160;&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:#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;        Assert.IsTrue(container.Kernel.ReleasePolicy.HasTrack(controller));&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;        Assert.IsFalse(controller.Disposed);&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:#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;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;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;    Assert.IsFalse(container.Kernel.ReleasePolicy.HasTrack(item));&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;    Assert.IsTrue(item.Disposed);&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:#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;/div&gt;
&lt;/div&gt;

&lt;p&gt;Notice that in order for the interceptor to intercept the call to Dispose we need to cast component to IDisposable before calling the method (‘using’ will do that for us). Notice important aspect of this test – it is completely container agnostic. It does not need any kind of explicit nor indirect reference to the container to work and to release the component properly. Let’s now see what happens behind the scenes.&lt;/p&gt;

&lt;h3&gt;Interceptor&lt;/h3&gt;

&lt;p&gt;The hero of the day, is the following interceptor:&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;background-color:#f4f4f4;margin:20px 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:550px;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;[Transient]&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:#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;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; ReleaseComponentInterceptor : IInterceptor&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;{&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:#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;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;static&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;readonly&lt;/span&gt; MethodInfo dispose = &lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt;(IDisposable).GetMethods().Single();&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;    &lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;readonly&lt;/span&gt; IKernel kernel;&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:#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;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:#0000ff;"&gt;public&lt;/span&gt; ReleaseComponentInterceptor(IKernel kernel)&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:#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;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:#0000ff;"&gt;this&lt;/span&gt;.kernel = kernel;&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:#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;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;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;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Intercept(IInvocation invocation)&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;    {&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:#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;if&lt;/span&gt; (invocation.Method == dispose)&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;        {&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:#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;            kernel.ReleaseComponent(invocation.Proxy);&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;        }&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:#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;else&lt;/span&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;        {&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:#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;            invocation.Proceed();&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;        }&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:#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;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;/div&gt;
&lt;/div&gt;

&lt;p&gt;Most of the time it just sits there and does nothing. However if it detects a call to Dispose, it releases the component from the container, which will in turn invoke the Dispose again (this time on the class, not interface, and since the interface is implemented non-virtually that second call won’t be intercepted), perform all other decommission job for the component as well as all its dependencies and it will release it, so that it can be garbage collected afterwards.&lt;/p&gt;

&lt;p&gt;This is just another useful trick, worth knowing if you want to keep your design container agnostic while still reaping full benefits it provides.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55161" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/E731vfimEPY" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/krzysztof_kozmic/archive/tags/Castle/default.aspx">Castle</category><feedburner:origLink>http://devlicio.us/blogs/krzysztof_kozmic/archive/2010/01/27/transparently-releasing-components-in-windsor.aspx</feedburner:origLink></item><item><title>How to detect the text encoding of a file</title><link>http://feedproxy.google.com/~r/Devlicious/~3/W_4WqbQ19Rk/how-to-detect-the-text-encoding-of-a-file.aspx</link><pubDate>Wed, 27 Jan 2010 01:18:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55142</guid><dc:creator>sergiopereira</dc:creator><slash:comments>10</slash:comments><description>&lt;p&gt;
Today I needed a way to identify ANSI (Windows-1252) and UTF-8 files in a directory filled with files of
these two types. I was surprised to not find a simple way of doing this via a property of method somewhere
under the &lt;code&gt;System.IO&lt;/code&gt; namespace.
&lt;/p&gt;
&lt;p&gt;
Not that it&amp;#39;s that hard to identify the encoding programmatically, but it&amp;#39;s always better when you
don&amp;#39;t need to write a method yourself. Anyway, here&amp;#39;s what I came up with. It detects UTF-8 encoding
based on the encoding signature added to the beginning of the file.
&lt;/p&gt;
&lt;p&gt;
The code below is specific to UTF-8 but shouldn&amp;#39;t be too hard to extend the example to
detect more encodings.
&lt;/p&gt;
&lt;pre name="code" class="csharp:nogutter"&gt;public static bool IsUtf8(string fname){
  using(var f = File.Open(fname, FileMode.Open)){
    var sig = new byte[Encoding.UTF8.GetPreamble().Length];
    f.Read(sig, 0, sig.Length);
    return sig.SequenceEqual(Encoding.UTF8.GetPreamble());
  }
}&lt;/pre&gt;

&lt;p&gt;
Maybe I just looked in the wrong places. Does anyone know a simpler way in the framework to accomplish this?
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55142" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/W_4WqbQ19Rk" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/sergio_pereira/archive/tags/.NET/default.aspx">.NET</category><category domain="http://devlicio.us/blogs/sergio_pereira/archive/tags/Tips-and-Tricks/default.aspx">Tips-and-Tricks</category><feedburner:origLink>http://devlicio.us/blogs/sergio_pereira/archive/2010/01/26/how-to-detect-the-text-encoding-of-a-file.aspx</feedburner:origLink></item><item><title>XNA 3D Primer Published – Get a free copy!</title><link>http://feedproxy.google.com/~r/Devlicious/~3/hpTPP8GVi_g/xna-3d-primer-published-get-a-free-copy.aspx</link><pubDate>Tue, 26 Jan 2010 01:57:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55134</guid><dc:creator>Michael C. Neel</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;&lt;a href="http://www.wrox.com/WileyCDA/WroxTitle/XNA-3D-Primer.productCd-0470596937.html"&gt;&lt;img style="border-right-width:0px;margin:0px 10px 10px 0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="XNA 3D Primer by Michael C. Neel" alt="XNA 3D Primer by Michael C. Neel" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/vinull/image_5F00_3.png" width="104" align="left" border="0" height="133" /&gt;&lt;/a&gt; In June of 2006 I officially became a professional author when &lt;i&gt;&lt;a href="http://www.aspnetpro.com/"&gt;ASP.NET Pro&lt;/a&gt;&lt;/i&gt; published my article &amp;ldquo;&lt;a href="http://www.vinull.com/Post/2008/10/11/google-can-you-hear-me.aspx"&gt;Google Can You Hear Me?&lt;/a&gt;&amp;rdquo;.&amp;nbsp; (So eager was I to be published I submitted my code in VB!).&amp;nbsp; Now I&amp;rsquo;m proud to announce Wrox has published &amp;ldquo;&lt;a href="http://www.wrox.com/WileyCDA/WroxTitle/XNA-3D-Primer.productCd-0470596937.html"&gt;XNA 3D Primer&lt;/a&gt;&amp;rdquo; as a Wrox Blox (aka eBook).&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Why did I write this book?&lt;/b&gt;&amp;nbsp; Truth be told, I&amp;rsquo;ve always admired technical book authors that can teach not only the how, but the why of a subject.&amp;nbsp; It&amp;rsquo;s no secret I&amp;rsquo;m a fan of &lt;a href="http://www.charlespetzold.com/"&gt;Charles Petzold&lt;/a&gt;; ever since I read &amp;ldquo;Programming Windows 95&amp;rdquo; (my first Windows version that I wrote applications for) I&amp;rsquo;ve wanted to join the ranks of great technical authors.&amp;nbsp; I of course am not there yet &amp;ndash; this is my first book and I kept it simple by writing a 40 page ebook.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Who did I write this book for?&lt;/b&gt;&amp;nbsp; A book is nothing without an audience.&amp;nbsp; This book is written for the line-of-business application developer who is curious about writing 3D games using XNA.&amp;nbsp; &lt;a href="http://www.xna.com/"&gt;XNA&lt;/a&gt; is Microsoft&amp;rsquo;s platform for game development and includes a .Net based managed framework that can be run on Windows PCs and the Xbox 360.&amp;nbsp; You can even sell your games over &lt;a href="http://www.xbox.com/en-US/games/community/default.htm"&gt;Xbox Live Indie Games&lt;/a&gt;.&amp;nbsp; Some experience with XNA is expected, but not more than working though the &lt;a href="http://creators.xna.com/en-US/education/gettingstarted"&gt;getting started beginner&amp;rsquo;s guides&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;What does this book cover?&lt;/b&gt;&amp;nbsp; The book is a surface tour of 3D programming.&amp;nbsp; When I first started 3D programming I felt like all the documentation was in Latin.&amp;nbsp; None of the lingo made sense, and I had trouble just figuring out what I needed to search on.&amp;nbsp; The book covers the basics of 3D space and the core math you&amp;rsquo;ll use over and over again.&amp;nbsp; It then moves on to handling the camera, working with 3D models, collision detection, and ends with methods to animate 3D models.&amp;nbsp; None of these topics are covered in great depth, but I found touching each one gives the &amp;ldquo;full picture&amp;rdquo; to the parts of a 3D game.&amp;nbsp; Think of this book more as a guided safari instead of a full expedition into the jungles of XNA 3D.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;You said free copy?&lt;/b&gt; Yes, though this free copy isn&amp;rsquo;t without cost.&lt;/p&gt;
&lt;p&gt;First, you can buy &lt;a href="http://www.wrox.com/WileyCDA/WroxTitle/XNA-3D-Primer.productCd-0470596937.html"&gt;XNA 3D Primer from Wrox for $6.99&lt;/a&gt; (this is cheaper than my &amp;ldquo;free&amp;rdquo; offer below).&lt;/p&gt;
&lt;p&gt;Since this is my first published book I wanted to do something special.&amp;nbsp; Initially I was going to donate the money I earned from the book (which isn&amp;rsquo;t much &amp;ndash; this was written for pleasure not profit) to &lt;a href="http://www.childsplaycharity.org"&gt;Child&amp;rsquo;s Play&lt;/a&gt;.&amp;nbsp; What is Child&amp;rsquo;s Play?&amp;nbsp; In their own words:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;Since 2003, over 100,000 gamers worldwide have banded together through Child&amp;rsquo;s Play, a community based charity grown and nurtured from the game culture and industry. Over 5 million dollars in donations of toys, games, books and cash for sick kids in children&amp;rsquo;s hospitals across North America and the world have been collected since our inception.&lt;/p&gt;
&lt;p&gt;This year, we have continued expanding across the country and the globe. With almost 70 partner hospitals and more arriving every month, you can be sure to find one from the map above that needs your help! You can choose to purchase requested items from their online retailer wish lists, or make a cash donation that helps out Child&amp;rsquo;s Play hospitals everywhere. Any items purchased through Amazon will be shipped directly to your hospital of choice, so please be sure to select their shipping address rather than your own.&lt;/p&gt;
&lt;p&gt;When gamers give back, it makes a difference!&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;Then I &lt;span style="text-decoration:line-through;"&gt;stole&lt;/span&gt; got an idea from &lt;a href="http://sethgodin.typepad.com/"&gt;Seth&lt;/a&gt;.&amp;nbsp; Instead of giving the money outright, I offer to anyone interested to make a $30.00 (or more) donation to Child&amp;rsquo;s Play.&amp;nbsp; Then email me the receipt and I&amp;rsquo;ll send you a free copy of XNA 3D Primer.&amp;nbsp; You&amp;rsquo;re making the donation, so you get to take the tax deduction and you get the good feeling that comes when giving a donation.&lt;/p&gt;
&lt;p&gt;When I explained the idea to my publisher, Wrox, not only did they love it, they offered to pitch in.&amp;nbsp; On my own I would have been able to give away 50 copies of my book; Wrox has doubled this so I can give away 100!&lt;/p&gt;
&lt;p&gt;So, the steps are:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Go to &lt;a title="http://www.childsplaycharity.org/" href="http://www.childsplaycharity.org/"&gt;http://www.childsplaycharity.org/&lt;/a&gt; and click the PayPal donate link (just under the map) &lt;/li&gt;
&lt;li&gt;Donate $30 (or more) &lt;/li&gt;
&lt;li&gt;Email the PayPal reciept to &lt;a href="mailto:michael.neel%2Bxna@gmail.com"&gt;michael.neel+xna@gmail.com&lt;/a&gt; (yes, there is a plus sign in the email) &lt;/li&gt;
&lt;li&gt;I will email you a (DRM-free) PDF of XNA 3D Primer (please give me a day or so, the process is manual) &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Once these 100 copies are gone, that&amp;rsquo;s it &amp;ndash; I&amp;rsquo;ll update this post with the remaining copies and the total raised for Child&amp;rsquo;s Play.&amp;nbsp; &lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55134" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/hpTPP8GVi_g" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/vinull/archive/tags/books/default.aspx">books</category><category domain="http://devlicio.us/blogs/vinull/archive/tags/xna/default.aspx">xna</category><feedburner:origLink>http://devlicio.us/blogs/vinull/archive/2010/01/25/xna-3d-primer-published-get-a-free-copy.aspx</feedburner:origLink></item><item><title>Duplicated columns in generated sql from NHibernate</title><link>http://feedproxy.google.com/~r/Devlicious/~3/jYbFiVsKrjc/duplicated-columns-in-generated-sql-from-nhibernate.aspx</link><pubDate>Mon, 25 Jan 2010 13:57:25 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55126</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>1</slash:comments><description>&lt;p&gt;I was trying to profile some NHibernate sql to see if we could make some improvements.&amp;#160;&amp;#160; One thing I noticed very shortly after starting this task was that one of my columns was being duplicated.&amp;#160; Now this is NOT going to make a huge performance difference but was something I wanted to remove this as it felt ‘wrong’.&amp;#160; Below is the original sql segment&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;pre class="sql" name="code"&gt;resrole1_.PART_B_PROVIDER_NO             as PART16_29_0_,
resrole1_.ADMIN_SET_ID                   as ADMIN17_29_0_,
resrole1_.NATIONAL_PROVIDER_ID           as NATIONAL18_29_0_,
resrole1_.Admin_Set_ID                   as Admin17_29_0_,
resrole1_.Resource_Type                  as Resource19_29_0_,&lt;/pre&gt;

&lt;p&gt;The first thing I looked at when I started to look for the cause was the mapping for the entity (Role entity) to make sure the ‘Admin_Set_ID’ is not mapped multiple times.&amp;#160; And of course it was not.&amp;#160; After a few minutes of staring at the screen (everyone knows this is how all the hard problems are solved) it dawned on me that Admin_Set_ID was a FK from one of my associations.&amp;#160; Below is my association that was using it.&lt;/p&gt;

&lt;pre class="C#" name="code"&gt;References( x =&amp;gt; x.ResourceType )
	.Access.AsCamelCaseField( Prefix.Underscore )
        .WithColumns( &amp;quot;Admin_Set_ID&amp;quot;, &amp;quot;Resource_Type&amp;quot; )
        .FetchType.Select()
        .LazyLoad();&lt;/pre&gt;

&lt;p&gt;Because Admin_Set_Id is a FK I should NOT have been mapping as part of my entity.&amp;#160; When I removed this column from my entity so that I could get it as part of my association.&amp;#160; When I did this my newly outputted sql looked like below:&lt;/p&gt;

&lt;pre class="sql" name="code"&gt;resrole1_.PART_B_PROVIDER_NO             as PART16_29_0_,
resrole1_.ADMIN_SET_ID                   as ADMIN17_29_0_,
resrole1_.NATIONAL_PROVIDER_ID           as NATIONAL18_29_0_,
resrole1_.Resource_Type                  as Resource19_29_0_,&lt;/pre&gt;

&lt;p&gt;Long story short is this.&amp;#160; If you happen to see a column being duplicated in your generated sql make sure that you are not referencing/mapping a FK directly in your mappings.&amp;#160; &lt;/p&gt;

&lt;p&gt;Hope this helps.&lt;/p&gt;

&lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55126" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/jYbFiVsKrjc" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/NHibernate/default.aspx">NHibernate</category><feedburner:origLink>http://devlicio.us/blogs/derik_whittaker/archive/2010/01/25/duplicated-columns-in-generated-sql-from-nhibernate.aspx</feedburner:origLink></item><item><title>Incorporating Video into a Silverlight 4 Application</title><link>http://feedproxy.google.com/~r/Devlicious/~3/yxv5DtgisfQ/incorporating-video-into-a-silverlight-4-application.aspx</link><pubDate>Mon, 25 Jan 2010 12:00:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55124</guid><dc:creator>Scott Seely</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;



&lt;/p&gt;
&lt;p&gt;Over the past week, I spent some time with Silverlight 4. I&amp;rsquo;m really impressed by how easy it is to incorporate video into an application. This post shows how to capture video from the camera and display the video on the screen. The post also handles grabbing single frames of video. You might use this type of arrangement to allow users to upload images, hold impromptu web casts, and to do video conferencing.&lt;/p&gt;
&lt;p&gt;I&amp;rsquo;ve uploaded a barebones application that turns on video capture and displays the video (viewable &lt;a href="http://www.scottseely.com/blog/10-01-24/Incorporating_Video_into_a_Silverlight_4_Application.aspx"&gt;here&lt;/a&gt;) &lt;/p&gt;
&lt;p&gt;To understand how this works, you need to be familiar with the following objects:&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CaptureSource&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;CaptureDeviceConfiguration&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;VideoBrush&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;The &lt;b&gt;CaptureSource&lt;/b&gt; type encapsulates the methods needed to interact with audio and video devices. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;CaptureDeviceConfiguration&lt;/b&gt; acts as gatekeeper to the webcam and microphone. &lt;b&gt;CaptureDeviceConfiguration&lt;/b&gt; knows how to ask the user for permission to use the webcam or microphone. It also remembers what the user said about using the webcam or microphone during the current session. &lt;/p&gt;
&lt;p&gt;&lt;strong&gt;VideoBrush &lt;/strong&gt;knows how to paint using a video as the source.&lt;/p&gt;
&lt;p&gt;In order to interact with the camera, you need to know whether the user gave you permission and if not, you have to ask for permission. Once you have permission, you just need to capture video from the default camera, create the brush, and start capturing the video. &lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;private &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;CaptureSource &lt;/span&gt;_captureSource = &lt;span style="color:blue;"&gt;null&lt;/span&gt;;
&lt;span style="color:blue;"&gt;private void &lt;/span&gt;btnStartCapture_Click(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;RoutedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:blue;"&gt;if &lt;/span&gt;(_captureSource != &lt;span style="color:blue;"&gt;null &lt;/span&gt;&amp;amp;&amp;amp; &lt;/pre&gt;
&lt;pre class="code"&gt;        _captureSource.State == &lt;span style="color:#2b91af;"&gt;CaptureState&lt;/span&gt;.Started)
    {
        &lt;span style="color:blue;"&gt;return&lt;/span&gt;;
    }
    &lt;span style="color:blue;"&gt;if&lt;/span&gt;(!&lt;span style="color:#2b91af;"&gt;CaptureDeviceConfiguration&lt;/span&gt;.AllowedDeviceAccess)
    {
        &lt;span style="color:blue;"&gt;if&lt;/span&gt;(!&lt;span style="color:#2b91af;"&gt;CaptureDeviceConfiguration&lt;/span&gt;.RequestDeviceAccess())
        {
            &lt;span style="color:blue;"&gt;return&lt;/span&gt;;
        }
    }

    _captureSource = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;CaptureSource
       &lt;/span&gt;{
         VideoCaptureDevice = &lt;/pre&gt;
&lt;pre class="code"&gt;           &lt;span style="color:#2b91af;"&gt;CaptureDeviceConfiguration&lt;/span&gt;.GetDefaultVideoCaptureDevice()
       };
    &lt;span style="color:blue;"&gt;var &lt;/span&gt;brush = &lt;span style="color:blue;"&gt;new &lt;/span&gt;&lt;span style="color:#2b91af;"&gt;VideoBrush&lt;/span&gt;();
    brush.SetSource(_captureSource);
    _captureSource.Start();
    rectVideo.Fill = brush;
}&lt;/pre&gt;
&lt;p&gt;Later on, when the user wants to capture the current video as an image, you just do something like this to put the current frame into an image control:&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;private void &lt;/span&gt;btnGrabImage_Click(&lt;span style="color:blue;"&gt;object &lt;/span&gt;sender, &lt;span style="color:#2b91af;"&gt;RoutedEventArgs &lt;/span&gt;e)
{
    &lt;span style="color:blue;"&gt;if&lt;/span&gt;(_captureSource == &lt;span style="color:blue;"&gt;null &lt;/span&gt;|| _captureSource.State != &lt;span style="color:#2b91af;"&gt;CaptureState&lt;/span&gt;.Started)
    {
        &lt;span style="color:blue;"&gt;return&lt;/span&gt;;
    }
    _captureSource.AsyncCaptureImage(
        image =&amp;gt; imgCapture.Source = image
        );
}&lt;/pre&gt;
&lt;p&gt;As someone who spent way too much time in the C++/MFC era writing code to capture video from devices, I am incredibly impressed with the brevity of the code. I think the SL4 team did an awesome job here. Way to go! &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can grab the sample project &lt;a href="http://www.scottseely.com/downloads/WebCam/DimeCast.WebCam.zip"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55124" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/yxv5DtgisfQ" height="1" width="1"/&gt;</description><feedburner:origLink>http://devlicio.us/blogs/scott_seely/archive/2010/01/25/incorporating-video-into-a-silverlight-4-application.aspx</feedburner:origLink></item><item><title>Alabama Code Camp in Mobile</title><link>http://feedproxy.google.com/~r/Devlicious/~3/_6KqekidkNM/alabama-code-camp-in-mobile.aspx</link><pubDate>Fri, 22 Jan 2010 16:24:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55118</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>0</slash:comments><description>&lt;p&gt;I’ll be at the &lt;a href="http://www.alabamacodecamp.com/"&gt;Alabama Code Camp&lt;/a&gt; this weekend in Mobile, AL, along our very own &lt;a href="http://devlicio.us/blogs/alan_northam/default.aspx"&gt;Alan Northam&lt;/a&gt;. Like all code camps, this is a free event. If you are anywhere in the area I recommend attending. The schedule is posted on the site and there are a lot of great sessions.&lt;/p&gt;  &lt;p&gt;I’m doing two presentations: one on source control concepts that I did at the Jacksonville and Tallahassee code camps. The other is a brand new presentation about the basics of &lt;em&gt;game development&lt;/em&gt;, with a primer for XNA and how to port the source to Silverlight using &lt;a href="http://silversprite.codeplex.com/"&gt;SilverSprite&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;You can also follow the event on Twitter with the hashtag #ALCC.&lt;/p&gt;  &lt;p&gt;Hope to see you there.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55118" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/_6KqekidkNM" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/source+control/default.aspx">source control</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Game+Development/default.aspx">Game Development</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/XNA/default.aspx">XNA</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Presentations/default.aspx">Presentations</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/SilverSprite/default.aspx">SilverSprite</category><feedburner:origLink>http://devlicio.us/blogs/christopher_bennage/archive/2010/01/22/alabama-code-camp-in-mobile.aspx</feedburner:origLink></item><item><title>Passing NULL into Overloaded Methods in unit tests…</title><link>http://feedproxy.google.com/~r/Devlicious/~3/3XW7p9kMvxw/passing-null-into-overloaded-methods-in-unit-tests.aspx</link><pubDate>Thu, 21 Jan 2010 12:08:31 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55104</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>6</slash:comments><description>&lt;p&gt;Today I was adding some new logic to some older code and I noticed there was very little test coverage on the logic so I decided to add some.&amp;#160; As I was adding coverage I wanted to add some tests that proved out our &lt;a href="http://research.microsoft.com/en-us/projects/contracts/"&gt;Contract&lt;/a&gt; style bound checks.&amp;#160; However there was one slight problem.&amp;#160; The method(s) I wanted to add coverage to was overloaded as such:&lt;/p&gt;  &lt;pre class="c#" name="code"&gt;public virtual IMessageTransporter GetTransporter( Destination destination )
{
    // The null transporter will allow for testing without hittng rhapsody or an engine
    if ( ConfigurationReader.UseNullTransporter ) { return new NullTransporter(); }

    Contracts.Requires( destination != null );
    
    // for now we only have one transporter for now.... will add more later
    return new HttpTransporter( destination.Endpoint );

}&lt;/pre&gt;

&lt;p&gt;and&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;public virtual IMessageTransporter GetTransporter( Endpoint endpoint )
{
    // The null transporter will allow for testing without hittng rhapsody or an engine
    if ( ConfigurationReader.UseNullTransporter ) { return new NullTransporter(); }

    Contracts.Requires( endpoint != null );
    
    // for now we only have one transporter for now.... will add more later
    return new HttpTransporter( endpoint  );

}&lt;/pre&gt;

&lt;p&gt;As you can see from the 2 methods above they are the same with ONLY the provided parameter being different.&amp;#160; When I started to write my tests I did this:&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;transporterFactory.GetTransporter( null );&lt;/pre&gt;

&lt;p&gt;But when I simply added NULL as the parameter the compiler provided me the following error&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;The call is ambiguous between the following methods or properties: ‘TransporterFactory.GetTransporter(Destination)&amp;#39; and TransporterFactory.GetTransporter(Endpoint)&amp;#39;&amp;#160;&amp;#160;&amp;#160; C:\PathHere\TransporterFactoryTests.cs&amp;#160;&amp;#160;&amp;#160; 13&amp;#160;&amp;#160;&amp;#160; 45&amp;#160;&amp;#160;&amp;#160; Common.Tests&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Now if you think about it for even 2 seconds the above error makes perfect sense.&amp;#160; So the real question is how do you get around this….?&amp;#160; Simple you do the following.&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;transporterFactory.GetTransporter( (Destination)null );&lt;/pre&gt;

&lt;p&gt;By providing a type on your call the compiler now will know which overload you are attempting to call and the world will be a happier place.&lt;/p&gt;

&lt;p&gt;Till next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55104" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/3XW7p9kMvxw" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/.Net/default.aspx">.Net</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/HowTo/default.aspx">HowTo</category><feedburner:origLink>http://devlicio.us/blogs/derik_whittaker/archive/2010/01/21/passing-null-into-overloaded-methods-in-unit-tests.aspx</feedburner:origLink></item><item><title>A new feature request for C# I would like is fall through exceptions</title><link>http://feedproxy.google.com/~r/Devlicious/~3/iNrvomdkESI/a-new-feature-request-for-c-i-would-like-is-fall-through-exceptions.aspx</link><pubDate>Wed, 20 Jan 2010 23:58:16 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55086</guid><dc:creator>Derik Whittaker</dc:creator><slash:comments>16</slash:comments><description>&lt;p&gt;Now before you write off this post as being ‘just another silly request’ hear me out.&lt;/p&gt;  &lt;p&gt;Right now in C# we can do the following &lt;/p&gt;  &lt;pre class="c#" name="code"&gt;switch( someObject )
{
	case Option1:
	case Option2:
	case Option3:
		// do something
		break;
	case Option4:
		// do something
		break:
} &lt;/pre&gt;

&lt;p&gt;Allowing fall through for a switch statement is a powerful technique.&amp;#160; It allows for multiple case statements in the same switch block to use the exact same logic, oh, and it also allows for code reduction.&lt;/p&gt;

&lt;p&gt;Given the fact that we can do this with a switch statement why can we not do this with try-catch statements?&amp;#160; &lt;/p&gt;

&lt;p&gt;As an example(s) (or a suggestion of syntax) why could we not have the following&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;try
{

} catch ( SomeException1 ) {
} catch ( SomeException2 ) {
} catch ( SomeException3 ) {
} catch ( SomeException4 se ) { 
	// do something
} catch ( SomeException5 se ) {
	// do something
}&lt;/pre&gt;

&lt;p&gt;OR&lt;/p&gt;

&lt;pre class="c#" name="code"&gt;try
{

} catch ( SomeException1, SomeException2, SomeException3, SomeException4 se ) { 
	// do something
} catch ( SomeException5 se ) {
	// do something
}
 &lt;/pre&gt;

&lt;p&gt;I know, I know you think I have lost my mind.&amp;#160; But think about it.&amp;#160; There are times when you want to handle multiple exception types with the exact same logic.&amp;#160; However today when you do this you are forced to either create a helper method to handle the logic or repeat the logic over and over again.&amp;#160; If we had the ability to allow for fall through exceptions we could reduce duplicated code and reduce code noise.&lt;/p&gt;

&lt;p&gt;Now before you start asking questions like … let me provide some quick Q &amp;amp; A&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q)&lt;/strong&gt; If you do this you will never be able to know exactly what type of exception was thrown.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A)&lt;/strong&gt; You are correct, but in this scenario do you really care about the exception type?&amp;#160; If you did I am going to guess you would break it out into individual catch block&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q)&lt;/strong&gt; When would this situation actually be practical?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;A)&lt;/strong&gt; Consider this.&amp;#160; You are creating a connection to a 3rd party resource (web service, wcf, api, etc) and that connection can throw a few different exceptions.&amp;#160; In some cases if the expected exception is throw you want to log and maybe roll back a transaction or something.&amp;#160; In this case i do not want to re-throw (or just let bubble up) the exception, but at the same time I do not want to duplicate my code.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;/p&gt;

&lt;p&gt;So, let me have it.&amp;#160; Tell me how dumb this is.&lt;/p&gt;

&lt;p&gt;Tell next time,&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55086" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/iNrvomdkESI" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Development/default.aspx">Development</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/.Net/default.aspx">.Net</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Feedback/default.aspx">Feedback</category><category domain="http://devlicio.us/blogs/derik_whittaker/archive/tags/Opinion/default.aspx">Opinion</category><feedburner:origLink>http://devlicio.us/blogs/derik_whittaker/archive/2010/01/20/a-new-feature-request-for-c-i-would-like-is-fall-through-exceptions.aspx</feedburner:origLink></item><item><title>ASP.NET Support in ReSharper 5</title><link>http://feedproxy.google.com/~r/Devlicious/~3/W76Z8l0myeE/asp-net-support-in-resharper-5.aspx</link><pubDate>Wed, 20 Jan 2010 17:04:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55082</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>4</slash:comments><description>&lt;p&gt;Although I mentioned briefly in the past some of the new features ASP.NET MVC features &lt;a href="http://www.jetbrains.com/resharper"&gt;ReSharper&lt;/a&gt; 5 supports, I thought it would be a good idea to sum up the main ones in a single post and go into a little bit more detail on them. &lt;/p&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;
&lt;h3&gt;ASP.NET&lt;/h3&gt;
&lt;p&gt;ReSharper &amp;lsquo;s support for ASP.NET is not restricted only to MVC.In fact, most of the new features are for general ASP.NET, be it WebForms (also known as Traditional, Classic, For Historical Purposes Only?) or MVC. &lt;/p&gt;
&lt;h4&gt;&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;Go to File Member&lt;/h4&gt;
&lt;p&gt;As part of the code navigation features of ReSharper, you have the possibility to locate a file member, be it a method, property, class, etc. very easily by using the the &lt;i&gt;Go To File Member&lt;/i&gt; (Alt+\) option. You can search instantly and hit Enter to navigate to the specific one. [For the record, I&amp;rsquo;m using the Visual Studio Keyboard Scheme. If you&amp;rsquo;re using IntelliJ (why?) go to the web site and download the &lt;a href="http://www.jetbrains.com/resharper/documentation/documentation.html"&gt;PDF mapping files&lt;/a&gt;.]&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_5EB46561.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_497639EC.png" border="0" height="229" width="447" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Notice how it it looks for anything that matches the characters introduced, so for instance typing &amp;ldquo;Exc&amp;rdquo; would give us all those with the word &amp;ldquo;Exception&amp;rdquo;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_453C3C5A.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_75831110.png" border="0" height="193" width="452" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Well you now have this functionality in ASPX, ASCX, ASAX and Web.config files also as of ReSharper 5!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_4DFC1ED9.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_44BFE398.png" border="0" height="371" width="357" /&gt;&lt;/a&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The same goes for the File Structure tool Window (Ctrl+Alt+F). &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_5981B64B.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_7EFB0DDF.png" border="0" height="354" width="466" /&gt;&lt;/a&gt;&amp;nbsp; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Go To Related Files&lt;/h4&gt;
&lt;p&gt;Many times, an ASPX has references to other files, such as Cascading Style Sheets, Javascript Files, Master Pages and User Controls. You can now navigate to these files efficiently by using the Go To Related Files (Ctrl+Alt+F7)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_5593A014.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_34DCB0A2.png" border="0" height="251" width="669" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Master Pages&lt;/h4&gt;
&lt;p&gt;Version 5 also adds support for Master and Content Pages. To begin with, we have added support for navigation. Using &lt;i&gt;Go To Declaration (&lt;/i&gt;Ctrl+Left Mouse) on the &lt;i&gt;ContentPlaceHolderID&lt;/i&gt; will take you from the Content Form/Page to the corresponding ContentPlaceHolder of the Master Page&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_27F234B7.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5760A383.png" border="0" height="81" width="660" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_49ADE77B.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_7341B2AE.png" border="0" height="155" width="662" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;If you are in the Master Page, you can navigate to all its inheritors (Shift+Alt+F12)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_7E1E93F6.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_22CFAB6E.png" border="0" height="269" width="459" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;You can also create content place holders from usage. When defining a &lt;i&gt;ContentPlaceHolderID &lt;/i&gt;that does not exist, you have the option to create it in the Master Page (Alt+Enter)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_4901DEF9.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_3C2788DB.png" border="0" height="148" width="668" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Last but not least, in a page that uses a master page, you can generate content place holders by pressing Alt+Ins&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_3CD03F05.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5010F5A4.png" border="0" height="250" width="201" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;which in turn will bring up a dialog box for you to pick and choose what you want&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_543ACD69.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_514568B6.png" border="0" height="236" width="425" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;User Controls &lt;/h4&gt;
&lt;p&gt;You can now navigate to user controls as well as automatically import the correct references. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_26A987D9.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_4C33053A.png" border="0" height="187" width="504" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;File Generation&lt;/h4&gt;
&lt;p&gt;There are new code generation options for ASP.NET with version 5. By pressing Alt+Ins in the Solution Explorer, we are presented with a popup menu&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_28B660D5.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_789BE986.png" border="0" height="576" width="311" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;where you can choose from a selection of items to generate. You can also access this menu from anywhere (not only in the Solution Explorer) by now pressing Ctrl+Alt+Ins. This is actually an awesome new addition to ReSharper 5 (Ctrl+Alt+Ins) and it removes even more friction when create new items!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_154538CF.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5A115D03.png" border="0" height="185" width="409" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;We&amp;rsquo;re asked for a name (which is the base minimum required to create an item) and If the item selected requires more information, then we&amp;rsquo;ll be prompted accordingly. For example, when creating a WebForm with Master Page, it&amp;rsquo;s convenient to specify which Master Page we want to use. In this case, once the page has been created, we&amp;rsquo;ll be given a chance to provide this information&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_220F6920.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_6094B6C6.png" border="0" height="113" width="505" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;I have to say, that I love Ctrl+Alt+Ins in ReSharper 5. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Refactoring and Assistance&lt;/h4&gt;
&lt;p&gt;In terms of Refactoring and Coding Assistance there are a few new features. One of them is the auto-update of ending tags. If you have for instance a &lt;i&gt;div&lt;/i&gt; tag, and want to change it to &lt;i&gt;span&lt;/i&gt;, as you start typing &lt;i&gt;span&lt;/i&gt;, the end tag is automatically updated to reflect the changes you&amp;rsquo;re making live. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_04D99B49.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_3A8EE0A3.png" border="0" height="431" width="251" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;If you have a series of elements that you want to surround within a tag, you can easily do this by selecting all the elements and choosing Surround with Template (Ctrl+E,U)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_2ABF25D2.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_21EF1D86.png" border="0" height="225" width="365" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_6C95E553.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_7D9A1336.png" border="0" height="174" width="131" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_28FE3431.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_079E8E95.png" border="0" height="101" width="369" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;ASP.NET MVC &lt;/h3&gt;
&lt;p&gt;ReSharper 5 treats ASP.NET MVC as a first class citizen. As such, it now has knowledge of concepts such as Views, Controllers and Action. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;Navigate to View&lt;/h4&gt;
&lt;p&gt;For those of you working with ASP.NET MVC, you might have noticed that Views are now underlined in Actions&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_77AF49D0.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_043CF6ED.png" border="0" height="118" width="430" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;When you click on the View with Ctrl+Left Mouse, you&amp;rsquo;ll be presented with a dropdown menu&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_6D2E75B0.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_79BC22CC.png" border="0" height="87" width="437" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Here you have two options. The first is to navigate to the source for the &lt;i&gt;View &lt;/i&gt;method (navigation to external sources is another new feature of ReSharper 5). The second option is to go to the View. Although you can navigate to the View in Visual Studio by right-clicking and selecting &lt;i&gt;Go To View&lt;/i&gt;, one advantage the underlining adds is that it serves as hint for non-existent views, as you can see in the action below, which doesn&amp;rsquo;t have a corresponding View file. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_49B1D14B.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_5CF287EA.png" border="0" height="118" width="380" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;View discovery also works with named Views. If a named view exists, the string literal will be underlined&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_061A2029.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_64BA7A8C.png" border="0" height="111" width="380" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;On the other hand, if it doesn&amp;rsquo;t exist, it will be highlighted as an error, once again providing you the benefit of discovering any missing views earlier on. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_7B994C08.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_485D129F.png" border="0" height="129" width="373" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;h4&gt;&amp;nbsp;&lt;/h4&gt;
&lt;h4&gt;Action Links&lt;/h4&gt;
&lt;p&gt;Those of us who have worked with ASP.NET MVC applications, know the problems with using strings when defining ActionLinks. Not only do you run into issues when refactoring, but misspelling an action or controller causes unnecessary pain. Some of us, including myself, have often resorted to using the expression based Actions available in the MVC Futures library. &lt;/p&gt;
&lt;p&gt;ReSharper 5 now provides Intellisense, preventing you from mistyping Actions and Controllers&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_73C13399.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_04592E88.png" border="0" height="143" width="550" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Similar to named Views, if you define a non-existing Action, you will get it highlighted. The difference here is that by pressing Alt+Enter, ReSharper will create the Action for you (create based on usage)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_0163C9D5.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_37854224.png" border="0" height="131" width="550" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_55171D23.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_4CB347CC.png" border="0" height="138" width="549" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;And much like Views, you can now navigate to Actions and Controllers from an ActionLink by choosing &lt;i&gt;Go To Declaration &lt;/i&gt;(Ctrl+Left Mouse) on the Action and Controller respectively. &lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_70F82C4E.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_02F44A0F.png" border="0" height="155" width="554" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h4&gt;User Controls &lt;/h4&gt;
&lt;p&gt;Navigation is also provided for User Controls&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_78DFA8E3.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_49418A57.png" border="0" height="98" width="476" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;as well as Intellisense&lt;/p&gt;
&lt;p&gt;&lt;a href="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_019F8B63.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" alt="image" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb_5F00_6371CDAE.png" border="0" height="161" width="475" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;Summary&lt;/h3&gt;
&lt;p&gt;I&amp;rsquo;ve outlined some of the main features that ReSharper 5 brings to the table in regard to ASP.NET. There are many smaller features that you can discover eventually as you play with it more. If you haven&amp;rsquo;t yet, make sure you download 5 from &lt;a href="http://www.jetbrains.com"&gt;JetBrains&lt;/a&gt;. Don&amp;rsquo;t forget to follow &lt;a href="http://twitter.com/resharper"&gt;ReSharper on Twitter&lt;/a&gt; if you want tips, tricks and latest info.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55082" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/W76Z8l0myeE" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ASP.NET+MVC/default.aspx">ASP.NET MVC</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ReSharper/default.aspx">ReSharper</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ASP.NET/default.aspx">ASP.NET</category><feedburner:origLink>http://devlicio.us/blogs/hadi_hariri/archive/2010/01/20/asp-net-support-in-resharper-5.aspx</feedburner:origLink></item><item><title>On ALT.NET and patience</title><link>http://feedproxy.google.com/~r/Devlicious/~3/6FEwgCOXjWI/on-alt-net-and-patience.aspx</link><pubDate>Tue, 19 Jan 2010 20:42:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55063</guid><dc:creator>sergiopereira</dc:creator><slash:comments>8</slash:comments><description>&lt;p&gt;
There ALT.NET bashing season is on full steam. Ian Cooper has a &lt;a href="http://codebetter.com/blogs/ian_cooper/archive/2010/01/19/whither-alt-net.aspx"&gt;thorough post&lt;/a&gt; about it.
&lt;/p&gt;
&lt;p&gt;
To my recollection, ALT.NET was formed by people that shared very similar tastes on what 
represents good development tools, practices, and methodologies. This group of people, 
just by the simple fact that they decided to get together under one roof to discuss these 
ideas, showed that they are constantly and decidedly trying to become better at what 
they do.

&lt;/p&gt;

&lt;p&gt;But when you take the step to form a new community or movement (or whatever else you
want to call it) you can&amp;#39;t easily control who jumps on board or who jumps ship - and 
you shouldn&amp;#39;t even try to.
&lt;/p&gt;
&lt;p&gt;Inevitably the original idea started to attract many different kinds of participants, 
which I&amp;#39;m going to roughly distribute in the below four categories (I was tempted to 
use the term personas, but … never mind.)
&lt;/p&gt;
&lt;ol&gt;
	&lt;li&gt;
		&lt;b&gt;I&amp;#39;m here to help&lt;/b&gt;&lt;br /&gt;
		&lt;ul&gt;
			&lt;li&gt;I like to teach,&lt;/li&gt;
			&lt;li&gt;to write,&lt;/li&gt;
			&lt;li&gt;to contribute to OSS,&lt;/li&gt;
			&lt;li&gt;coordinating UGs and events&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;b&gt;Those who like to complain&lt;/b&gt;&lt;br /&gt;
		A very minor percentage of those know how to externalize their criticism in a constructive way. Unfortunately 
		the majority limit their contributions to rants and trolling. &lt;br /&gt;
		That&amp;#39;s probably the only group of people that I&amp;#39;d try to weed out if I could (but I can&amp;#39;t; and we shouldn&amp;#39;t).
	&lt;/li&gt;
	&lt;li&gt;
		&lt;b&gt;Those who want to learn&lt;/b&gt;&lt;br /&gt;
		&lt;ul&gt;
			&lt;li&gt;They want to hear about other ideas,&lt;/li&gt;
			&lt;li&gt;to figure out how to bring better practices to their work,&lt;/li&gt;
			&lt;li&gt;they have a specific problem and they&amp;#39;re seeking opinions or answers.&lt;/li&gt;
		&lt;/ul&gt;
	&lt;/li&gt;
	&lt;li&gt;
		&lt;b&gt;Heliotropic migrants&lt;/b&gt;&lt;br /&gt;
		The ones who want to be linked to (and hops on) every new, shiny thing for commercial 
		reasons. There&amp;#39;s always this type of people. They need to latch on to what 
		could be the next big thing for the sake of their own livelihood. There&amp;#39;s 
		nothing wrong with that, by the way.
	&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Some people just can&amp;#39;t put up with the other types. Some folks go ballistic with 
people on &lt;b&gt;#4&lt;/b&gt;, others can&amp;#39;t stand the whiners in &lt;b&gt;#2&lt;/b&gt;. Some don&amp;#39;t tolerate repeated or trivial questions 
from folks that are just trying to learn.
&lt;/p&gt;

&lt;p&gt;In the midst of all this, it becomes hard to connect &lt;b&gt;#1&lt;/b&gt; and &lt;b&gt;#3&lt;/b&gt;, which I think is 
the ultimate reason for ALT.NET existence.
&lt;/p&gt;

&lt;p&gt;Frankly speaking, I think I&amp;#39;ve personally danced around in all these four categories 
but I find myself most of the time in &lt;b&gt;#3&lt;/b&gt; and some other times in &lt;b&gt;#1&lt;/b&gt;. I do apologize 
for my ventures in &lt;b&gt;#2&lt;/b&gt; – it&amp;#39;s hard to avoid.
&lt;/p&gt;

&lt;p&gt;So, if you dabble in the ALT.NET waters, let me just ask you to exercise a little 
bit of patience. We all still have a lot to learn and there&amp;#39;s very good indications that 
some of those lessons are permeating the .NET development community &amp;mdash;
from the individual developer to the big Enterprise, Inc.
&lt;/p&gt;

&lt;p&gt;Let&amp;#39;s no try to change the world with a single swing of the bat. Changing one 
constructor method at a time will get us further. In the end, the idea is simply to 
more efficiently produce more maintainable and reliable software.
&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55063" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/6FEwgCOXjWI" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/sergio_pereira/archive/tags/alt.net/default.aspx">alt.net</category><category domain="http://devlicio.us/blogs/sergio_pereira/archive/tags/Community/default.aspx">Community</category><feedburner:origLink>http://devlicio.us/blogs/sergio_pereira/archive/2010/01/19/on-alt-net-and-patience.aspx</feedburner:origLink></item><item><title>Caliburn v1.1 Release Candidate Available!</title><link>http://feedproxy.google.com/~r/Devlicious/~3/XYN_goMebv4/caliburn-v1-1-release-candidate-available.aspx</link><pubDate>Tue, 19 Jan 2010 03:10:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55060</guid><dc:creator>Rob Eisenberg</dc:creator><slash:comments>2</slash:comments><description>&lt;p&gt;Since our v1 release of Caliburn in October, we&amp;rsquo;ve had a healthy amount of bug fixes and feature improvements.&amp;nbsp; The community has really gotten involved and contributed in a big way.&amp;nbsp; The result of this contribution is the forthcoming v1.1.&amp;nbsp; As of this post, &lt;a target="_blank" href="http://caliburn.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=39042"&gt;the release candidate is available for download&lt;/a&gt;.&amp;nbsp; It&amp;rsquo;s a release almost entirely created based on feedback and patches from the community, with very little of my own ideas involved.&amp;nbsp; Below is a list of fixes/improvements if you care to dig into the gritty details:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Added pre-initialization hooks to CaliburnApplication via Marco Amendola&amp;#39;s patch.&lt;/li&gt;
&lt;li&gt;Redesign of IThreadPool.&amp;nbsp; AsynchronousAction will now pass itself as state when enqueing the background task.&lt;/li&gt;
&lt;li&gt;Closed ticket #4672 by making PropertyChangedBase.PropertyChanged virtual.&lt;/li&gt;
&lt;li&gt;Applied jagregory&amp;#39;s patch to add single key gestures to WPF and Caliburn.&lt;/li&gt;
&lt;li&gt;Applied marcoamendola&amp;#39;s patch for enabling property path syntax with Preview and Dependency attributes. So you can now do things like [Dependencies(&amp;quot;Model.IsValid&amp;quot;)].&lt;/li&gt;
&lt;li&gt;Applied marcoamendola&amp;#39;s patch enabling type hinting for polymorphic databinding in Caliburn.Testability.&lt;/li&gt;
&lt;li&gt;Applied etobi&amp;#39;s patch to greatly improve Caliburn&amp;#39;s parameter parsing in ActionMessages and CommandMessages. See &lt;a href="http://caliburn.codeplex.com/WorkItem/View.aspx?WorkItemId=4644"&gt;http://caliburn.codeplex.com/WorkItem/View.aspx?WorkItemId=4644&lt;/a&gt; for an explanation.&lt;/li&gt;
&lt;li&gt;Closed ticket #4826. DefaultWindowManager now sets WindowStartupLocation to CenterOwner for UserControls hosted in windows. Title was enhanced to databind to IPresenter.DisplayName if model implements this interface.&lt;/li&gt;
&lt;li&gt;Closed ticket #4833. Fixed an issue with ViewMetadata and invalid Windows in DefaultViewStrategy.&lt;/li&gt;
&lt;li&gt;Fixed a bug with DefaultWindowManager which caused errors when creating main windows from a user control.&lt;/li&gt;
&lt;li&gt;Improved the flexibility of the DefaultViewStrategy. It no longer requires separate namespaces for ViewModels/Views.&lt;/li&gt;
&lt;li&gt;Closed ticket #4865. Fixed a bug in MultiPresenterManager which affects multiple presenter shutdown.&lt;/li&gt;
&lt;li&gt;Applied sedovav&amp;#39;s fix to the Spring adapter.&lt;/li&gt;
&lt;li&gt;Enhanced DefaultViewStrategy&amp;#39;s exception to report searched for types when view location fails.&lt;/li&gt;
&lt;li&gt;Applied cheesus&amp;#39; recommendations to add unwire capability to IEventHandler.&lt;/li&gt;
&lt;li&gt;Improved PresenterManager and MultiPresenterManager such that all changes to CurrentPresenter go through ChangeCurrentPresenterCore.&lt;/li&gt;
&lt;li&gt;Bug fixes and improvements to DependenciesAttribute, PreviewAttribute, DependencyObserver and PropertyPathMonitory.&lt;/li&gt;
&lt;li&gt;Added strongly-typed property change notification to PropertyChangedBase.&lt;/li&gt;
&lt;li&gt;Fixed a bug in the SimpleContainer related to generic component registration.&lt;/li&gt;
&lt;li&gt;Added ILifecycleNotifier.AttemptingShutdown which gets fired before the CanShutdownCore method on PresenterBase is called. &lt;/li&gt;
&lt;li&gt;Fixed a bug in AsnychronousAction related to IPreExecute, BlocksInteraction and AffectsTriggers.&lt;/li&gt;
&lt;li&gt;Added IWindowManager and DefaultWindowManager for SL3 and SL4.&lt;/li&gt;
&lt;li&gt;Fixed a few bugs in property change testing.&lt;/li&gt;
&lt;li&gt;Fixed a bug in the MEFAdapter.&lt;/li&gt;
&lt;li&gt;Fixed a bug in the design-time support for Availability Effects in the AvailabilityEffectConverter.&lt;/li&gt;
&lt;li&gt;Updated to Castle Windsor 2.1, Dynamic Proxy 2.2. Added official Windsor support for Silverlight 3.0 and 4.0&lt;/li&gt;
&lt;li&gt;Fixed a minor bug in View Contexts.&lt;/li&gt;
&lt;li&gt;Enabled WPF Action parameters to bind to default event/property by specifying only an element name as the arg.&lt;/li&gt;
&lt;li&gt;Added the Silverlight Navigation Sample to How Tos.&lt;/li&gt;
&lt;li&gt;Created three different build-*.cmd for the major build scenarios.&lt;/li&gt;
&lt;/ul&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55060" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/XYN_goMebv4" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF/default.aspx">WPF</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Xaml/default.aspx">Xaml</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/WPF_2F00_e/default.aspx">WPF/e</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/.NET+3.5/default.aspx">.NET 3.5</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Caliburn/default.aspx">Caliburn</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Featured/default.aspx">Featured</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/RIA/default.aspx">RIA</category><category domain="http://devlicio.us/blogs/rob_eisenberg/archive/tags/MVVM/default.aspx">MVVM</category><feedburner:origLink>http://devlicio.us/blogs/rob_eisenberg/archive/2010/01/18/caliburn-v1-1-release-candidate-available.aspx</feedburner:origLink></item><item><title>Silverlight Breakpoints Not Being Hit</title><link>http://feedproxy.google.com/~r/Devlicious/~3/mRTuLLJm0Nk/silverlight-breakpoints-not-being-hit.aspx</link><pubDate>Sun, 17 Jan 2010 20:55:21 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:55045</guid><dc:creator>Christopher Bennage</dc:creator><slash:comments>4</slash:comments><description>&lt;p&gt;Just a quick and simple reminder. If you run into the case where you are not hitting breakpoints in your Silverlight code, take a look at the properties of your hosting web project (if applicable).&lt;/p&gt;  &lt;p&gt;On the Web tab, under Debuggers is a set of checkboxes.&lt;/p&gt;  &lt;p&gt;&lt;img style="border-bottom:0px;border-left:0px;display:inline;border-top:0px;border-right:0px;" title="Web Project Properties" border="0" alt="Web Project Properties" src="http://devlicious.com/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/christopher_5F00_bennage/image_5F00_3AA64D49.png" width="557" height="422" /&gt;&lt;/p&gt;  &lt;p&gt;First, ensure that Silverlight is checked. &lt;/p&gt;  &lt;p&gt;If it is already checked, then uncheck it, save the project, check it back, and save again.&lt;/p&gt;  &lt;p&gt;I’ve had this fix the problem at least once.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=55045" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/mRTuLLJm0Nk" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Silverlight/default.aspx">Silverlight</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Tips+_2600_amp_3B00_+Tricks/default.aspx">Tips &amp;amp; Tricks</category><category domain="http://devlicio.us/blogs/christopher_bennage/archive/tags/Visual+Studio/default.aspx">Visual Studio</category><feedburner:origLink>http://devlicio.us/blogs/christopher_bennage/archive/2010/01/17/silverlight-breakpoints-not-being-hit.aspx</feedburner:origLink></item><item><title>Castle Windsor 2.1, Dynamic Proxy 2.2 and more released!</title><link>http://feedproxy.google.com/~r/Devlicious/~3/C0lE_eOu4WA/castle-windsor-2-1-dynamic-proxy-2-2-and-more-released.aspx</link><pubDate>Tue, 12 Jan 2010 17:06:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:54977</guid><dc:creator>Krzysztof Koźmic</dc:creator><slash:comments>9</slash:comments><description>&lt;h4&gt;&lt;b&gt;Update: &lt;/b&gt;Due to a regression error discovered in Windsor Factory Support Facility, we decided to act fast and provide updated package of Windsor, without the issue. &lt;a title="Get it here." href="http://sourceforge.net/projects/castleproject/files/InversionOfControl/2.1/Castle-Windsor-2.1.1.zip/download"&gt;Get it here.&lt;/a&gt; Sorry for the inconvenience.&lt;br /&gt;&lt;/h4&gt;
&lt;p&gt;&lt;a href="http://castleproject.org/"&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="Castle Project" alt="Castle Project" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/krzysztof_5F00_kozmic/castleinabox1_5F00_1D537618.gif" border="0" height="108" width="191" /&gt;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;What better way of starting a new year can there be, than fresh set of releases from Castle Project?!&lt;/p&gt;
&lt;h3&gt;Core 1.2 (with more)&lt;/h3&gt;
&lt;p&gt;Castle Core 1.2 has now its own, separate package. Since the beta few things have changed&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Email sender component is now integrated with Core, so if you were using it, you now should look for it in Castle.Core.dll. The version shipped with Core 1.2 has the following major breaking changes:     &lt;br /&gt;- Removed Message, MessageAttachment and MessageAttachmentCollection classes and replaced them with MailMessage, Attachment and AttachmentCollection from .NET classes in System.Net.Mail&lt;/li&gt;
&lt;li&gt;Logging services (integration of Castle&amp;rsquo;s logging abstraction with log4net and NLog) is now packaged with Core. Notice that these are dependent on Core (just like it used to be). Castle does not have dependency on any of these, so don&amp;rsquo;t freak out. &lt;/li&gt;
&lt;li&gt;few minor bugs were fixed, but nothing serious. You should be able to just switch the reference to new version and start using it with no changes to your code. &lt;/li&gt;
&lt;li&gt;We ship four versions: for .NET 2.0, for .NET 3.5, for Silverlight 3.0 and for Mono 2.6 &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Get it &lt;a href="https://sourceforge.net/projects/castleproject/files/Core/1.2/Castle.Core-1.2.zip/download" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;Dynamic Proxy 2.2&lt;/h3&gt;
&lt;p&gt;This is a pretty significant release. If you haven&amp;rsquo;t before, read &lt;a href="http://kozmic.pl/archive/2009/12/04/castle-dynamic-proxy-2.2-beta-in-the-wild.aspx" target="_blank"&gt;what we had in beta&lt;/a&gt;. Since then, the following has changed&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Interface members on proxies are behaving almost identical to version 2.1 (change from beta). That means that they take long name of explicit implementation (InterfaceName.Method() instead of Method()), only if you already have a method called Method() on your proxy, either from base class or other interface. And even then, it will still be public, which makes it more transparent to the user. &lt;/li&gt;
&lt;li&gt;We ship three versions: for .NET 2.0 (this is the last version to support .NET 2.0), .NET 3.5 and Silverlight 3.0 &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Get it &lt;a href="https://sourceforge.net/projects/castleproject/files/DynamicProxy/2.2/Castle.DynamicProxy-2.2.zip/download" target="_blank"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;h3&gt;MicroKernel/Windsor 2.1.1 (with support for Silverlight)&lt;/h3&gt;
&lt;p&gt;Probably the biggest thing about this release is that it includes a Silverlight version. There are a couple more highlights thought&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://kozmic.pl/archive/2009/12/24/castle-typed-factory-facility-reborn.aspx" target="_blank"&gt;revamped typed factory facility&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;added ability to specify Type Forwarding via XML config with the following syntax:
&lt;div style="border:1px solid silver;margin:20px 0px 10px;padding:4px;overflow:auto;text-align:left;line-height:12pt;background-color:#f4f4f4;width:97.5%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;max-height:550px;font-size:8pt;cursor:text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;" id="codeSnippet"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;component&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;  &lt;span style="color:#ff0000;"&gt;id&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;hasForwards&amp;quot;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;  &lt;span style="color:#ff0000;"&gt;type&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Castle.MicroKernel.Tests.ClassComponents.TwoInterfacesImpl, Castle.MicroKernel.Tests&amp;quot;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;  &lt;span style="color:#ff0000;"&gt;service&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Castle.MicroKernel.Tests.ClassComponents.ICommon, Castle.MicroKernel.Tests&amp;quot;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;  &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;forwardedTypes&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;    &lt;span style="color:#0000ff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;add&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;service&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;=&amp;quot;Castle.MicroKernel.Tests.ClassComponents.ICommon2, Castle.MicroKernel.Tests&amp;quot;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;  &lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;forwardedTypes&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;

&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;&lt;span style="color:#0000ff;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color:#800000;"&gt;component&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;&lt;a href="http://kozmic.pl/archive/2009/12/10/castle-windsor-new-feature-ndash-dynamic-parameters-from-registration-site.aspx" target="_blank"&gt;added DynamicParameters&lt;/a&gt; (with additional option to return delegate to be called upon component&amp;rsquo;s destruction) &lt;/li&gt;
&lt;li&gt;added OnCreate method, which lets you act upon component after it&amp;rsquo;s created, and before it&amp;rsquo;s removed (see &lt;a href="http://tunatoksoz.com/post/Implementing-EnrichWith%28of-StructureMap%29-with-Castle.aspx" target="_blank"&gt;this Tehlike&amp;rsquo;s post&lt;/a&gt;. Notice it&amp;rsquo;s not in a facility now, so it just works out of the box.) &lt;/li&gt;
&lt;li&gt;&lt;a href="http://kozmic.pl/archive/2009/11/15/castle-windsor-lazy-loading.aspx" target="_blank"&gt;added lazy component loader&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://ayende.com/Blog/archive/2009/09/18/optimizing-windsor.aspx" target="_blank"&gt;major performance improvements in certain scenarios&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;and many bugfixes, see commit log for full list if you&amp;rsquo;re interested &lt;/li&gt;
&lt;li&gt;We ship two versions: for .NET 3.5 and for Silverlight 3.0 &lt;/li&gt;
&lt;li&gt;There is also logging facility included in the package. Again &amp;ndash; neither MicroKernel, nor Windsor depend on it, so don&amp;rsquo;t freak out. &lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Get it &lt;a href="http://sourceforge.net/projects/castleproject/files/InversionOfControl/2.1/Castle-Windsor-2.1.1.zip/download"&gt;here.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;We&amp;#39;re already gathering ideas for the next version, so go ahead to the &lt;a href="http://castle.uservoice.com/forums/16605-official-castle-project-feedback-forum"&gt;Castle UserVoice page&lt;/a&gt; and tell us, what you&amp;#39;d like to see in the next version!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=54977" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/C0lE_eOu4WA" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/krzysztof_kozmic/archive/tags/Castle/default.aspx">Castle</category><feedburner:origLink>http://devlicio.us/blogs/krzysztof_kozmic/archive/2010/01/12/castle-windsor-2-1-dynamic-proxy-2-2-and-more-released.aspx</feedburner:origLink></item><item><title>Writing plug-ins for ReSharper: Part 1 of Undefined</title><link>http://feedproxy.google.com/~r/Devlicious/~3/7oyEQE6QirU/writing-plug-ins-for-resharper-part-1-of-undefined.aspx</link><pubDate>Tue, 12 Jan 2010 13:27:00 GMT</pubDate><guid isPermaLink="false">40756a8b-6212-4073-9d98-6c26781577de:54980</guid><dc:creator>Hadi Hariri</dc:creator><slash:comments>7</slash:comments><description>&lt;p&gt;&lt;a href="http://www.jetbrains.com/resharper"&gt;ReSharper&lt;/a&gt; does a lot of things, but as they say, you can&amp;rsquo;t please &lt;a href="http://twitter.com/mfeathers/status/7406170728"&gt;all the&lt;/a&gt; people all of the time. However, one the great things about ReSharper is that it is quite extensible and there are already quite a number plug-ins available. Some of the better known ones are:&lt;/p&gt;
&lt;p&gt;- &lt;a href="http://stylecopforresharper.codeplex.com"&gt;StyleCop for ReSharper&lt;/a&gt; by &lt;a href="http://howard.vanrooijen.co.uk/blog"&gt;Howard Van Rooijen&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;- &lt;a href="http://code.google.com/p/resharper-tdd-productivity-plugin/"&gt;TDD Productivity Plugin&lt;/a&gt; by &lt;a href="http://www.lostechies.com/blogs/hex/"&gt;Eric Hexter&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;- &lt;a href="http://github.com/agross/machine.specifications/tree/master/Libraries/ReSharper/"&gt;ReSharper Test Runner&lt;/a&gt; for &lt;a href="http://github.com/machine/machine.specifications"&gt;MSpec&lt;/a&gt; by &lt;a href="http://therightstuff.de/"&gt;Alexander Gro&amp;szlig;&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;and of course there is also the &lt;a href="http://www.jetbrains.com/resharper/plugins/"&gt;repository of plug-ins available from the JetBrains site&lt;/a&gt;, where many of these are located. &lt;/p&gt;
&lt;p&gt;Now I&amp;rsquo;m no expert on writing plug-ins for ReSharper, and the authors of the previous ones leave the bar quite high, but seeing that I actually now have the time to play with them, I&amp;rsquo;ve decided to do so by sharing my experiences with you in a series of blog posts. &lt;/p&gt;
&lt;p&gt;The ReSharper API is pretty extensive and can be overwhelming as I&amp;rsquo;ve been discovering, so I want to try and take it slowly. This might mean that at times, the code is not always complete and might be missing a few checks for example, but will come in due course. &lt;/p&gt;
&lt;p&gt;Everything that I&amp;rsquo;ll cover applies to &lt;a href="http://www.jetbrains.com/resharper/beta/beta.html"&gt;version 5.0 which is currently in Beta&lt;/a&gt;. There have been some changes from previous versions so if you&amp;rsquo;re working with 4.5 some of the code might not work. &lt;/p&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;
&lt;h3&gt;The First Plug-in&lt;/h3&gt;
&lt;p&gt;I was initially intending to write a useless plug-in for the first demo that didn&amp;rsquo;t do much, but after talking to &lt;a href="http://twitter.com/orangy/"&gt;Orangy&lt;/a&gt; (aslo known as Ilya) who commented on a tweet Jeremy Skinner had posted a few days back:&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb51" alt="image_thumb51" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb51_5F00_7A64442B.png" border="0" height="238" width="473" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;we decided to use it as the first sample. &lt;/p&gt;
&lt;p&gt;I&amp;rsquo;m going to build up the sample over the next few series of posts, so the initial solution is not the ideal one or complete, but it will help introduce a few core concepts. Ideally this feature should be implemented as what&amp;rsquo;s known as a &lt;i&gt;QuickFix&lt;/i&gt; but we&amp;rsquo;re first going to do it as a &lt;i&gt;ContextAction&lt;/i&gt;. &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;ContextAction&lt;/h3&gt;
&lt;p&gt;So what exactly is a Context Action? It&amp;rsquo;s actions that can be applied based on the context (the name is quite descriptive). They shows up as items in a popup menu which is invoked using Alt+Enter (don&amp;rsquo;t use the mouse for this&amp;hellip;it&amp;rsquo;s very unproductive). &lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb4" alt="image_thumb4" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb4_5F00_7C711D27.png" border="0" height="97" width="244" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;What we want to do in this first version of the plug-in is to write a new action that makes methods that are public and not declared virtual, virtual, something NHibernate users would appreciate greatly. As mentioned previously, in this first version we&amp;rsquo;re going to add a context action. &lt;/p&gt;
&lt;p&gt;&lt;b&gt;1. Creating a plug-in assembly&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;ReSharper plug-ins are assemblies that are located in Plugins folder (by default %programFiles%\JetBrains\ReSharper\v5.0\Bin\Plugins). Each plug-in is in it&amp;rsquo;s own folder and doesn&amp;rsquo;t require any further registration. Therefore the first step is to create a class library which will host our context action.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;2. Creating the Context Action Skeleton&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;In order to create a context action, we need to implement the &lt;i&gt;IContextAction &lt;/i&gt;interface. This interface has one method &lt;i&gt;IsAvailable&lt;/i&gt; which indicates to us if that particular action is available given the context, and a property of type &lt;i&gt;IBulbItem[]&lt;/i&gt; which contains a series of bulb items. Each &lt;i&gt;IBulbItem&lt;/i&gt; in turn has a property &lt;i&gt;Text&lt;/i&gt; which is the text that appears next to the item in the context dropdown, and an &lt;i&gt;Execute &lt;/i&gt;action, which is what happens when the item is selected. So as we can see, a context action can consist of more than one bulb item. An added benefit to this decoupling is the re-usability of bulb items. By implementing &lt;i&gt;IBulbItem&lt;/i&gt;, we can potentially use it in more than once place (obviously if it makes sense).&lt;/p&gt;
&lt;p&gt;Many times however, we only want one bulb item per action, and to somehow simplify the process, we can inherit from the &lt;i&gt;BulbItemImpl &lt;/i&gt;class. This class defines an abstract &lt;i&gt;Text &lt;/i&gt;property that represents the text of the bulb item, and also has an &lt;i&gt;ExecuteTransaction&lt;/i&gt; member which is where our code is executed. We&amp;rsquo;ll see the difference between this method and &lt;i&gt;Execute&lt;/i&gt; shortly.&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:6bd1437c-d08c-453d-8bfd-63640ee43d54" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, 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;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;MakeMethodVirtualContextActions&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;: &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;BulbItemImpl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IContextAction&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;protected&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;Action&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ITextControl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt; ExecuteTransaction(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ISolution&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; solution, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IProgressIndicator&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; progress)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&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="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;string&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; Text&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&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="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;get&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; { &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;(); }&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;bool&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; IsAvailable(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IUserDataHolder&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; cache)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&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="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Before implementing any of the methods, there&amp;rsquo;s one thing we need to do. ReSharper requires that context action have a constructor with a parameter that implements a &lt;i&gt;IContextActionDataProvider&lt;/i&gt;. This parameter is actually useful to use to provide information about the context as we&amp;rsquo;ll see shortly. Therefore, we need to add a constructor to the previous code (lines 6-9). Since our action is only for C#, we will use a &lt;i&gt;ICSharpContextActionDataProvider&lt;/i&gt;. We then save this provider for later use (line 3). What we&amp;rsquo;re effectively doing here of course is nothing more than dependency injection. The plumbing (passing in the correct provider) is taken care of for us by ReSharper.&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:8ccd7ae7-ad88-4e81-a256-4357e662b61b" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, 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;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;MakeMethodVirtualContextAction&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; : &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;BulbItemImpl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IContextAction&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;readonly&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ICSharpContextActionDataProvider&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; _provider;&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; MakeMethodVirtualContextAction(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ICSharpContextActionDataProvider&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; provider)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&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="background:#000000;color:#ffffff;"&gt;_provider = provider;&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;protected&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;Action&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ITextControl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt; ExecuteTransaction(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ISolution&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; solution, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IProgressIndicator&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; progress)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&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="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;string&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; Text&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&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="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;get&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; { &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;(); }&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;bool&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; IsAvailable(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IUserDataHolder&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; cache)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&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="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;throw&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;new&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;NotImplementedException&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;3. Defining Availability&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The next step is to define when our action is available. In order to do so, we need to implement the &lt;i&gt;IsAvailable&lt;/i&gt; method. In our case, we want to convert methods that are public and not virtual, to virtual. We therefore need to identify methods that are public and not virtual. We also need to filter out static methods. In order to get access to the current context we&amp;rsquo;re in, we can use the &lt;i&gt;provider&lt;/i&gt; we injected in via the constructor. The &lt;i&gt;provider &lt;/i&gt;has a &lt;i&gt;GetSelectedElement&lt;/i&gt; method which corresponds to the element the caret is on. Since we&amp;rsquo;re interested in a method, we can invoke this function, requesting back a method declaration. If the caret is in the context of a method (i.e. header, body), it will return this information. If it&amp;rsquo;s not, it will return null.&lt;/p&gt;
&lt;p&gt;If we have a valid method declaration, the next step is to find out if it is public. We do that by invoking &lt;i&gt;GetAccessRights &lt;/i&gt;[In later series we&amp;rsquo;ll see that further checks are necessary here]. If it is public, we then need to check whether it is a static method, an override or already virtual. Based on that, we return &lt;i&gt;true&lt;/i&gt; or &lt;i&gt;false&lt;/i&gt;, indicating whether the action is available in the current context. &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:08892768-5c0f-43d7-bcea-9d5c989520f2" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, 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;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;bool&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; IsAvailable(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IUserDataHolder&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; cache)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; item = _provider.GetSelectedElement&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IMethodDeclaration&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt;(&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;false&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;true&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;);&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;if&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; (item != &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;null&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&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="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; accessRights = item.GetAccessRights();&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;if&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; (accessRights == &lt;/span&gt;&lt;span style="background:#000000;color:#bf82d7;"&gt;AccessRights&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;.PUBLIC &amp;amp;&amp;amp; !item.IsStatic &amp;amp;&amp;amp; !item.IsVirtual &amp;amp;&amp;amp; !item.IsOverride)&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="background:#000000;color:#ffffff;"&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; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;true&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;;&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="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;false&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;;&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;4. Performing the action&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;When the action is available and the user selects it, what we need to do is make the method virtual. This is done in the &lt;i&gt;ExecuteTransaction&lt;/i&gt; method. Since we are going to modify the code, we need to make sure that the file is writable. Normally this would be done by invoking a call to a method named &lt;i&gt;EnsureWritable. &lt;/i&gt;However, inside the method &lt;i&gt;ExecuteTransaction&lt;/i&gt;, this is done for us, so we don&amp;rsquo;t have to worry about it. This is one of the differences between &lt;i&gt;ExecuteTransaction &lt;/i&gt;and &lt;i&gt;IBulbItem.Execute&lt;/i&gt;. &lt;/p&gt;
&lt;p&gt;So how do we go about modifying code in ReSharper? Well remember that refactoring code is ReSharper&amp;rsquo;s daily bread. It&amp;rsquo;s what it does. As such, there&amp;rsquo;s a ton of infrastructure in place to allow us to do modify code easily. In fact, making a method virtual is as easy as calling a method, as shown 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:1204f257-3604-47b1-8adc-681470f842d7" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, 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;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;protected&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;override&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;Action&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ITextControl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt; ExecuteTransaction(&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;ISolution&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; solution, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IProgressIndicator&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; progress)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;var&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; method = _provider.GetSelectedElement&amp;lt;&lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IMethodDeclaration&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;&amp;gt;(&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;false&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;true&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;);&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;if&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; (method != &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;null&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;)&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&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="background:#000000;color:#ffffff;"&gt;method.SetVirtual(&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;true&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;);&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;return&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;null&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;;&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;}&lt;/span&gt; &lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;b&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;5. Testing the plug-in&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The only thing left to do is test that it works (writing unit tests for plug-ins is something we&amp;rsquo;ll cover in the future). One option is to copy the assembly to the plug-in folder for ReSharper and restart Visual Studio. However, in order to be able to debug it, what we can do is set the project properties to start an external program, which is non other than &lt;i&gt;devenv.exe&lt;/i&gt;, and pass as parameter to it &lt;i&gt;/ReSharper.Plugin &amp;lt;Path_to_Plugin_Assembly&amp;gt;&lt;/i&gt;, instructing ReSharper to load a specific plug-in.&lt;/p&gt;
&lt;p&gt;How does ReSharper know which classes in the assembly are context actions? The easiest way is to decorate these with the &lt;i&gt;ContextAction &lt;/i&gt;attribute&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:816a2e31-64f6-4d00-80aa-ab30a90b5de4" class="wlWriterSmartContent"&gt;
&lt;div style="border-bottom:#000080 1px solid;border-left:#000080 1px solid;font-family:&amp;#39;Courier New&amp;#39;, 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;background:#000000;padding-top:0px;"&gt;
&lt;li&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;[&lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;ContextAction&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;(Group=&lt;/span&gt;&lt;span style="background:#000000;color:#a5c25c;"&gt;&amp;quot;C#&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, Name = &lt;/span&gt;&lt;span style="background:#000000;color:#a5c25c;"&gt;&amp;quot;MakeMethodVirtual&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, Description = &lt;/span&gt;&lt;span style="background:#000000;color:#a5c25c;"&gt;&amp;quot;Adds context action to make methods virtual&amp;quot;&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;)]&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;public&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#cc7832;"&gt;class&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;MakeMethodVirtualContextAction&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt; : &lt;/span&gt;&lt;span style="background:#000000;color:#ffc66d;"&gt;BulbItemImpl&lt;/span&gt;&lt;span style="background:#000000;color:#ffffff;"&gt;, &lt;/span&gt;&lt;span style="background:#000000;color:#6897bb;"&gt;IContextAction&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;{&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp; &lt;span style="background:#000000;color:#ffffff;"&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;     &lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This information is also what appears under ReSharper &amp;ndash;&amp;gt; C# &amp;ndash;&amp;gt; Context Actions&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb1" alt="image_thumb1" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb1_5F00_73A114DB.png" border="0" height="279" width="462" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Now all that&amp;rsquo;s left is to try it out. Write a new class, add a few methods and check to see it&amp;rsquo;s all working correctly.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb41" alt="image_thumb41" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb41_5F00_4C56A5D9.png" border="0" height="188" width="438" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Public static method (not available)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb5" alt="image_thumb5" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb5_5F00_5B3DD4F3.png" border="0" height="123" width="437" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Private method (not available)&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;a&gt;&lt;img style="border-right-width:0px;display:inline;border-top-width:0px;border-bottom-width:0px;border-left-width:0px;" title="image_thumb7" alt="image_thumb7" src="http://devlicio.us/cfs-file.ashx/__key/CommunityServer.Blogs.Components.WeblogFiles/hadi_5F00_hariri/image_5F00_thumb7_5F00_3EE06D06.png" border="0" height="206" width="434" /&gt;&lt;/a&gt; &lt;/p&gt;
&lt;p&gt;Public method (option available)&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:8eb9d37f-1541-4f29-b6f4-1eea890d4876:709f2834-932c-4f9c-b242-351e666e3c37" class="wlWriterSmartContent"&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:709f2834-932c-4f9c-b242-351e666e3c37" class="wlWriterSmartContent"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&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:8eb9d37f-1541-4f29-b6f4-1eea890d4876:905932bc-aad6-4994-8db7-63b30b97fccc" class="wlWriterSmartContent"&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:07444c36-2481-4557-b32b-f8c211b3e445" class="wlWriterSmartContent"&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:64c132f0-0ecb-48de-a052-a7760451521b" class="wlWriterSmartContent"&gt;
&lt;div style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;" id="scid:8eb9d37f-1541-4f29-b6f4-1eea890d4876:64c132f0-0ecb-48de-a052-a7760451521b" class="wlWriterSmartContent"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h3&gt;What&amp;rsquo;s next?&lt;/h3&gt;
&lt;p&gt;In this first part we&amp;rsquo;ve seen the basics of writing plug-ins for ReSharper. In the next blog post, we&amp;rsquo;ll extend the example to also include properties and we&amp;rsquo;ll change it to be a &lt;i&gt;QuickFix&lt;/i&gt; as opposed to a context action. This means that we&amp;rsquo;ll get some nice highlighting by ReSharper telling us something can be changed (similar to when you have something named incorrectly for instance), thus being more *in your face*.&lt;/p&gt;
&lt;p&gt;There&amp;rsquo;s so much more to see than what&amp;rsquo;s here, and gradually we&amp;rsquo;ll drill more into each of the different areas, examining parameters, return values, etc. Until then, Happy ReSharping (did I just coin that? Too lame?)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://devlicio.us/aggbug.aspx?PostID=54980" width="1" height="1"&gt;&lt;img src="http://feeds.feedburner.com/~r/Devlicious/~4/7oyEQE6QirU" height="1" width="1"/&gt;</description><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/Tools/default.aspx">Tools</category><category domain="http://devlicio.us/blogs/hadi_hariri/archive/tags/ReSharper/default.aspx">ReSharper</category><feedburner:origLink>http://devlicio.us/blogs/hadi_hariri/archive/2010/01/12/writing-plug-ins-for-resharper-part-1-of-undefined.aspx</feedburner:origLink></item></channel></rss>
