<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Opgenorth.NET &#187; .NET</title>
	<atom:link href="http://www.opgenorth.net/tag/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.opgenorth.net</link>
	<description>A software geek torn apart by the dicotomy of .NET by day, Ruby and Android by night</description>
	<lastBuildDate>Wed, 07 Sep 2011 03:30:09 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>TFS 2010, VS2010 Database Projects, and CI</title>
		<link>http://www.opgenorth.net/2010/11/29/tfs-2010-vs2010-database-projects-and-ci/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=tfs-2010-vs2010-database-projects-and-ci</link>
		<comments>http://www.opgenorth.net/2010/11/29/tfs-2010-vs2010-database-projects-and-ci/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 21:19:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Continous Integration]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2010/11/29/tfs-2010-vs2010-database-projects-and-ci/</guid>
		<description><![CDATA[I’m currently working on a project where there are some functional tests that require a SQL Server database. Before in the past I’ve always handled this by using Redgate’s excellent SQL Server tools to create a monolithic script that would deploy the DB Schema, and then another set of scripts to set up the data.&#160; [...]]]></description>
			<content:encoded><![CDATA[<p>I’m currently working on a project where there are some functional tests that require a SQL Server database. Before in the past I’ve always handled this by using Redgate’s excellent SQL Server tools to create a monolithic script that would deploy the DB Schema, and then another set of scripts to set up the data.&#160; Then it’s pretty trivial to use OSQL.EXE to run the scripts and setup the database.</p>
<p>However, in this case, I’m constrained to use the VS2010 database project and TFS Build.&#160; So, the trick for me became how to use TFS 2010 Team Build to deploy a fresh copy of the database before the functional tests are run.&#160; After a bit of jiggery-pokery, here is what I ended up doing.&#160; I’m sure that at some point in my future, I will have to do this again, and nothing helps my failing memory like writing it down.</p>
<p>First a rough overview:</p>
<ol>
<li>Declare some variables to hold the physical path of my .dbproj and the default data path for SQL Server. </li>
<li>Convert the source code control path of my .dbproj to the physical path on disk. </li>
<li>To help with debugging and diagnostics, write a build message with the location of the physical path of the .dbproj </li>
<li>Add an MSBuild task to my workflow that would deploy the .dbproj. </li>
</ol>
<p>Without further adieu, here is more details breakdown of the steps involved.</p>
<h4>Declare Variables</h4>
<p>So, first things first – declare the two variables I need to hold the physical path to the .dbproj file, and the directory for my SQL Server databases.&#160; This should be pretty simple and straight forward (assuming that the POS that is the “Workflow Designer” isn’t crashing VS2010 constantly).</p>
<p><a href="http://www.opgenorth.net/wp-content/uploads/2010/11/image.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.opgenorth.net/wp-content/uploads/2010/11/image_thumb.png" width="1000" height="379" /></a></p>
<p>Once that is out of the way I scrolled down the pretty, crashy, workflow designer until I came across the <u>Compile and Test</u> sequence.&#160; At the very start of it I added a sequence that I called <u>Deploy Database</u>.&#160; Inside this sequence I added the following Team Foundation Build Activities:</p>
<h4>ConvertWorkspaceItem</h4>
<p>The point to this BuildActivity is to figure where the hell on the file system TFS put one of the files.&#160; Pretty straight forward:</p>
<p><a href="http://www.opgenorth.net/wp-content/uploads/2010/11/image1.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.opgenorth.net/wp-content/uploads/2010/11/image_thumb1.png" width="691" height="192" /></a></p>
<h4>WriteBuildMessage</h4>
<p>Always nice to have a message in your log file to help with troubleshooting.&#160; Here’s what my WriteBuildMessage activity looks like.&#160; Notice that the message makes use of the “DbProjectPath” variable that we set above in the ConvertWorkspaceItemActivity.</p>
<p><a href="http://www.opgenorth.net/wp-content/uploads/2010/11/image2.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.opgenorth.net/wp-content/uploads/2010/11/image_thumb2.png" width="687" height="146" /></a></p>
<h4>MSBuild</h4>
<p>This the working part of the the sequence.&#160; In here we use MSBuild to call the .dbproj and deploy a fresh copy of the database to SQL Server. Key properties to set:</p>
<ul>
<li>CommandLineArguments : this contains the properties to pass on the command line when deploying.&#160; You’ll want to provide these properties
<ul>
<li>/p:TargetDatabase=YOUR_DATABASE_NAME </li>
<li>/p:”DefaultDataPath=DIRECTORY_OF_DATABASE_FILES” </li>
<li>/p:”TargetConnectionString=YOUR_CONNECTION_STRING_FOR_THE_TARGET_DATABASE” </li>
<li>/p:DeployToDatabase=True </li>
</ul>
</li>
<li>Configuration : just specify which configuration in the solution to use. </li>
<li>DisplayName : what ever you want, this is how the MSBuild activity will be displayed in your sequence </li>
<li>LogFile : the name of the log file for the deploy </li>
<li>OutDir : the output directory </li>
<li>Project : Notice that this is the value of DbProjectPath, which we set above in our ConvertWorkItem </li>
<li>RunCodeAnalysis : Set this to CodeAnalysisOption.Never.&#160; Doesn’t make much sense to do code analysis on a database project. </li>
<li>Targets : </li>
</ul>
<p>Here is what the properties look like for this particuar Build Activity:</p>
<p><a href="http://www.opgenorth.net/wp-content/uploads/2010/11/image3.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.opgenorth.net/wp-content/uploads/2010/11/image_thumb3.png" width="648" height="493" /></a></p>
<p>Now all of this has to live somewhere.&#160; You might want to have this live somewhere else depending on when or how you want the database to deploy.&#160; In my case, as I wanted to deploy the database BEFORE my tests ran, I hunted through the workflow and found the sequence called <u>Run Tests</u>.&#160; I modified one side of the If condition to include a new sequence call <u>Deploy DB and Run Tests</u>:<a href="http://www.opgenorth.net/wp-content/uploads/2010/11/image4.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.opgenorth.net/wp-content/uploads/2010/11/image_thumb4.png" width="501" height="349" /></a></p>
<p>Here is an overview of what my Deploy DB and Run Tests sequence looks like</p>
<p><a href="http://www.opgenorth.net/wp-content/uploads/2010/11/image5.png"><img style="background-image: none; border-right-width: 0px; margin: ; padding-left: 0px; padding-right: 0px; display: block; float: none; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://www.opgenorth.net/wp-content/uploads/2010/11/image_thumb5.png" width="257" height="502" /></a></p>
<p>&#160;</p>
<h4>After Thoughts</h4>
<p>To be honest, I found the whole process annoying and awkward.&#160; Sure, I didn’t have to edit a bunch of XML by hand, but the Workflow Designer in Visual Studio 2010 wasn’t exactly a joy to work with either.&#160; I don’t know exactly what the problem was, but it kept crashing while I was trying to edit this Build Process Template. It was always the same error, an Out of Memory Exception.&#160; On a Dell Latitude E6510 with 4GB of memory, this shouldn’t be happening.&#160; As well, the whole editing process for the work flow was awkward at best.</p>
<p>As much as I dislike XML based build tools, at least text editors don’t get all crashy and such.&#160; As well, I found the overall experience of trying to create and piece together the workflow for Team Build to be sluggish and tedious.&#160; It’s great to have a GUI editor to hide the crummy XML, but honestly, I think the way <a href="http://www.finalbuilder.com/home.aspx">FinalBuilder</a> works is far superior to how VS2010 in terms of easy of use and readability(application crashes aside).</p>
<p>Next is to setup my Release build definition, and to tackle the issue of updated the version number in AssemblyInfo.cs and creating a zip file of all the deployment artifacts.&#160; But first I’ve got to go and buy a bottle or two of Talisker to help numb the pain that will follow as I go done down that path.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2010/11/29/tfs-2010-vs2010-database-projects-and-ci/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>First Impressions: Windows Phone 7 Development</title>
		<link>http://www.opgenorth.net/2010/11/15/first-impressions-windows-phone-7-development/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=first-impressions-windows-phone-7-development</link>
		<comments>http://www.opgenorth.net/2010/11/15/first-impressions-windows-phone-7-development/#comments</comments>
		<pubDate>Tue, 16 Nov 2010 04:01:55 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Mobile]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[WP7]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2010/11/15/first-impressions-windows-phone-7-development/</guid>
		<description><![CDATA[I’ve spent a bit of my spare time in the past week looking at Windows Phone 7 from a developer’s point of view.  I’d have started sooner, but honestly, I didn’t see the point until there were actually devices that I could hold and use.  I know that in the U.S., some guys got developer [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve spent a bit of my spare time in the past week looking at Windows Phone 7 from a developer’s point of view.  I’d have started sooner, but honestly, I didn’t see the point until there were actually devices that I could hold and use.  I know that in the U.S., some guys got developer phones from Microsoft, but I don’t think that anybody up here in Canada was that lucky.</p>
<p>So, over the past year or so I’ve been dabbling with Android and I actually like programming for Android.  The biggest issues I’ve run into with Android are my lack of Java skills – I keep doing things the C# way (you really don’t realize how handy Linq is until you don’t have it) and the fact that Android doesn’t have a decent UI designer.  But otherwise, I like Android.</p>
<p>So, I was curious what the developer experience was for WP7.  In a nutshell – it’s not bad, and in some ways better than that of Android.</p>
<p>Things I like about WP7 development:</p>
<ul>
<li>Being a C# guy, it was pretty easy and fast for me to get going with WP7.  Of course, Novell now has <a href="http://www.monodroid.net">MonoDroid</a> which in theory should lessen the learning curve for a C# guy to create Android applications.</li>
<li>It’s nice to have good tooling to help with creating my UI’s.  Blend and Cider are pretty decent. Android does have <a href="http://droiddraw.org">DroidDraw</a>, but I’ve never really found that tool to be good to work with.  Eclipse has some sort of an GUI designer thingy, but again, I’ve found it to be kind of lack-lustre at best.  That, and I don’t use Eclipse – I prefer IntelliJ.</li>
<li>The Emulator seems to start up faster to me that the Android emulator – but that could just be me.</li>
<li>The MVVM pattern.  I know the theory, and am now learning the more practical side of it.  Was worried that WP7 was going to decent into the path of darkness and pain that was/is Web Forms.</li>
<li>I think that the debugger integrates better with the WP7 emulator.  Not that, generally speaking, I spend a lot of time in the debugger, but when you need it, it does seem to be more natural to me.  Again, this could just be because by day I do a lot of C# development so I’m more used to the Microsoft tooling to begin with.</li>
</ul>
<p>Some things I didn’t like about WP7 development:</p>
<ul>
<li>You have to have Vista or Windows 7.  Yes, I know, XP is almost 10 years old, time to move on.  Call me an O/S curmudgeon.  I don’t mind Windows 7, but Vista sucks/sucked.</li>
<li>It seems like to build your apps, you have to use Visual Studio 2010.  Not a problem for a developer, but I’m old school when it comes to compiling applications, and your build server shouldn’t be tainted by your IDE.</li>
<li>I’m use to the relatively easy going Google marketplace and the fact I have numerous avenues available to me to distribute Android applications.  No such joy with WP7 apps.</li>
<li>Editing XAML by hand.  But, I suppose it’s no worse that the XML resource files that Android uses.</li>
<li>Not seeing a lot of projects whose code I can read.  Granted it’s still early, so hopefully that will change.  Or not.  .NET doesn’t seem to have the same OSS community spirit that Java does.</li>
</ul>
<p>Microsoft has always tried to be pretty good to developers (sometimes to their own detriment), but I think Windows Phone 7 does have some things going for it, from a developer’s point of view anyway.  Here’s to hoping that strategy pays off – that cool apps will get written for WP7, and that it will be commercially viable.  Competition is good – it will keep Apple and Google on their toes.  <img class="wlEmoticon wlEmoticon-smile" style="border-style: none;" src="http://www.opgenorth.net/wp-content/uploads/2010/11/wlEmoticon-smile.png" alt="Smile" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2010/11/15/first-impressions-windows-phone-7-development/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Looking for a Job?</title>
		<link>http://www.opgenorth.net/2010/09/21/looking-for-a-job/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=looking-for-a-job</link>
		<comments>http://www.opgenorth.net/2010/09/21/looking-for-a-job/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 15:15:32 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Agile]]></category>
		<category><![CDATA[YEG]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2010/09/21/looking-for-a-job/</guid>
		<description><![CDATA[If you happen to be a .NET type, knowledgeable/interested in MVC and Agile, QuestionMark is looking for .NET developers (F/T only, no contractors) here in Edmonton, Alberta.&#160; Below is the job description.&#160; If you’re interested, send your resume to Kaitlyn Lardin at QuestionMark (kaitlyn AT questionmark DOT com): &#160; Senior Software Developer Background Questionmark is [...]]]></description>
			<content:encoded><![CDATA[<p>If you happen to be a .NET type, knowledgeable/interested in MVC and Agile, QuestionMark is looking for .NET developers (F/T only, no contractors) here in Edmonton, Alberta.&#160; Below is the job description.&#160; If you’re interested, send your resume to Kaitlyn Lardin at QuestionMark (kaitlyn AT questionmark DOT com):</p>
<p>&#160;</p>
<h3>Senior Software Developer</h3>
<p><b>Background</b></p>
<p>Questionmark is a company with a 20 year history recognised global presence in e-learning and assessment automation with software covering all aspects of this field, from authoring to delivery and reporting. Our software is used by over 3 million people in 15 different countries throughout the world. Questionmark<i> </i>is a fast-growing company, with a dedicated, passionate, and global workforce. We have offices in London, UK, Norwalk, CT and Tubize, Belgium. We care about the satisfaction of our employees and we reward them for meeting or exceeding expectations. The company promotes a relaxed, fun and highly productive approach to work. We have recently moved location to a vibrant office in the heart of downtown surrounded by software development companies.</p>
<p><b>Role of the Senior Developer</b></p>
<p>We are looking for a talented senior developer to join our development team in designing and creating the next generation of on-line assessment delivery software. This role will work closely with a Product Owner and other team members in a SCRUM environment, and be responsible for delivering potentially shippable functionality each Sprint. It also includes the mentoring of other team members through peer review. Our development team works in a Continuous Integration environment with automated builds and testing.</p>
<p><b>Essential skills:</b></p>
<p>· At least 5 years commercial experience development experience.</p>
<p>· You will be highly skilled in software development using our core technologies of C#, ASP.NET, XML, JavaScript, SQL Server and/or Oracle.</p>
<p>· Experience of jQuery very desirable </p>
<p>· Experience of working with .NET 2.0 or later</p>
<p>· Expertise in object oriented programming and relational databases</p>
<p>· Expertise in T-SQL and/or PL/SQL</p>
<p>· Good written and verbal communication. You must be able to write specifications</p>
<p>· Experience working in a SCRUM environment is desirable </p>
<p><b></b></p>
<p><b>Attributes of the Senior Software Developer:</b></p>
<p>The successful candidate will be highly skilled in software development using our core technologies, as above. You will be a self starting, self motivated individual who is enthusiastic and passionate about developing innovative software solutions.</p>
<p>Candidates must be eligible to work within Canada and relocate to Edmonton. </p>
<p><b>The package: </b></p>
<p>We offer excellent salary and benefits that include flexible working hours, starting 14 days annual leave, company bonus scheme, generous health coverage, and subsidized gym membership. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2010/09/21/looking-for-a-job/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Where Did the Time Go?</title>
		<link>http://www.opgenorth.net/2010/01/28/where-did-the-time-go/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=where-did-the-time-go</link>
		<comments>http://www.opgenorth.net/2010/01/28/where-did-the-time-go/#comments</comments>
		<pubDate>Fri, 29 Jan 2010 05:28:58 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Site News]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2010/01/28/where-did-the-time-go/</guid>
		<description><![CDATA[Yeah, I’ve been kind of quiet as of late.&#160; So quiet, I suspect that some people might be wondering if something happened.&#160; I was a bit surprised to see that the last time I had blogged was after TechDays in Calgary.&#160; Well, nothing significant has happened &#8211; just a bit of laziness augmented by a [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.opgenorth.net/wp-content/uploads/2010/01/tumbleweed1.jpg"><img title="tumbleweed" style="border-right: 0px; border-top: 0px; display: inline; margin-left: 0px; border-left: 0px; margin-right: 0px; border-bottom: 0px" height="75" alt="tumbleweed" src="http://www.opgenorth.net/wp-content/uploads/2010/01/tumbleweed_thumb1.jpg" width="90" align="left" border="0" /></a>Yeah, I’ve been kind of quiet as of late.&#160; So quiet, I suspect that some people might be wondering if something happened.&#160; I was a bit surprised to see that the last time I had blogged was after TechDays in Calgary.&#160; Well, nothing significant has happened &#8211; just a bit of laziness augmented by a touch of tech-burnout compounded by the odd bit of single malt scotch.</p>
<p>So, now that one month is almost up on 2010, I figured that it was time to start blogging about something again.&#160; The first trick to this, of course, was to figure out what I wanted to do in 2010.&#160; It does seem like there will be a lot of interesting things, technically speaking, coming up this year.</p>
<p>A couple of new things I want to look at over the remaining 11 months:</p>
<p>Mobile development, particularly with a focus on Android<a href="http://www.opgenorth.net/wp-content/uploads/2010/01/androidrobotlogo1.jpg"><img title="android-robot-logo1" style="border-right: 0px; border-top: 0px; display: inline; margin-left: 0px; border-left: 0px; margin-right: 0px; border-bottom: 0px" height="24" alt="android-robot-logo1" src="http://www.opgenorth.net/wp-content/uploads/2010/01/androidrobotlogo1_thumb.jpg" width="22" border="0" /></a>.&#160; For the latter half of 2009 I have been dabbling in Android.&#160; I believe that it’s time to go out on a bender, and in a drunken stupor get some embarrassing tattoo and join the Android Army.&#160; So far, I’m at two out of three.&#160; Not bad, huh?</p>
<p><a href="http://www.opgenorth.net/wp-content/uploads/2010/01/AndroidArmy.jpg"><img title="AndroidArmy" style="border-right: 0px; border-top: 0px; display: block; float: none; margin-left: auto; border-left: 0px; margin-right: auto; border-bottom: 0px" height="117" alt="AndroidArmy" src="http://www.opgenorth.net/wp-content/uploads/2010/01/AndroidArmy_thumb.jpg" width="244" border="0" /></a>&#160;</p>
<p>Ruby is another technology I’d like to explore – particularly Rails.&#160; I can help but think that the opinionated view that Rails development has taken is the way to go for the bulk of web development.&#160; A lot of websites are basically just forms over data, and Rails seems to address that concern rather well.&#160; To bad nobody around here in Edmonton does much Rails development.</p>
<p>.NET 4.0 and ASP.NET MVC2.&#160; I know there is a lot of debate between Web Forms and ASP.NET MVC.&#160; Personally, I think MVC is the better way.&#160; Probably best to keep abreast of what is going on in the ASP.NET MVC world.&#160; And, of course, the DLR in .NET will come to maturity soon.&#160; By maturity I mean widespread acceptance.&#160; If this happens, then maybe developers won’t get so hung up on languages:&#160; i.e. “I’m a C# guy so VB.NET sucks”.</p>
<p>And finally, a guy needs hobbies.&#160; Now granted, my past hobbies of alcohol and <a href="http://www.opgenorth.net/images/tom_AR.jpg">guns</a> (no, not together at the same time) have served me well for the past 20 years or so. However, they are hard hobbies to share with my sons at this point in time.&#160; So, at the start of winter I expanded the geek factor of my sons (and myself) by getting back into <a href="http://www.games-workshop.com">Warhammer</a>.&#160; Now the last time I played was about 20 years ago, with the 3rd edition rules.&#160; In fact, I still have some of the books in my basement from back then.&#160; Anyway, picked up <a href="http://www.games-workshop.com/gws/content/article.jsp?aId=700012a&amp;setLocale=en_CA&amp;amp;_requestid=1241948">The Battle for Skull Pass</a> boxed set.&#160; My son rather likes the <a href="http://www.games-workshop.com/gws/catalog/landingArmy.jsp?catId=cat210008&amp;rootCatGameStyle=">Dwarfs</a>.&#160; I suspect it’s because he’s similar in stature/height to the stunties.&#160; Myself, while I find the <a href="http://www.games-workshop.com/gws/catalog/landingArmy.jsp?catId=cat50030&amp;rootCatGameStyle=">Greenskins</a> amusing, I suspect I might have to move on and get serious with <a href="http://www.games-workshop.com/gws/catalog/landingArmy.jsp?catId=cat40032&amp;rootCatGameStyle=">Dark Elves</a>.</p>
<p>Anyway, enough for tonight.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2010/01/28/where-did-the-time-go/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Compiling ASP.NET MVC on Mono 2.4.3</title>
		<link>http://www.opgenorth.net/2009/11/11/compiling-asp-net-mvc-on-mono-2-4-3/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=compiling-asp-net-mvc-on-mono-2-4-3</link>
		<comments>http://www.opgenorth.net/2009/11/11/compiling-asp-net-mvc-on-mono-2-4-3/#comments</comments>
		<pubDate>Wed, 11 Nov 2009 16:52:17 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Mono]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2009/11/11/compiling-asp-net-mvc-on-mono-2-4-3/</guid>
		<description><![CDATA[Out of intellectual curiosity, I sparked up MonoDevelop and decided to see what would happen when I tried to compile the ASP.NET MVC source code. I figured that it would Just Work.&#160; After all, I can use the .NET compiled assembly with no problems on Mono, so there really shouldn&#8217;t be any problems trying to [...]]]></description>
			<content:encoded><![CDATA[<p>Out of intellectual curiosity, I sparked up <a href="http://www.monodevelop.com">MonoDevelop</a> and decided to see what would happen when I tried to compile the <a href="http://aspnet.codeplex.com/Release/ProjectReleases.aspx?ReleaseId=24471">ASP.NET MVC source code</a>. I figured that it would Just Work.&#160; After all, I can use the .NET compiled assembly with no problems on <a href="http://www.go-mono.com">Mono</a>, so there really shouldn&#8217;t be any problems trying to compile the code.&#160; Bad news is that there is one minor glitch.&#160; Good news is the glitch is easy to work around and has already been fixed so it shouldn&#8217;t be a problem for future version of Mono. </p>
<p>When you compile, here is what you get:</p>
<p><font face="monospace">Compilation failed: 1 error(s), 0 warnings</font>
<p>/home/tom/Projects/MVC-MS-Pl-original/MVC-MS-Pl/Mvc/FormCollection.cs(25,6): error CS0246: The type or namespace name `FormCollectionBinder&#8217; could not be found. Are you missing a using directive or an assembly reference?</p>
<p>Build complete &#8212; 1 error, 0 warnings</p>
</p>
<p>So, this kind of surprised me.&#160; Looking at the code, I did see the FormCollectionBinder in the code, it&#8217;s an embedded class within System.Web.Mvc.FormCollection, check out lines 68-88 below:   </p>
<div>
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> <span style="color: #008000">/* **************************************************************************** </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span> <span style="color: #008000"> * </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span> <span style="color: #008000"> * Copyright (c) Microsoft Corporation. All rights reserved. </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span> <span style="color: #008000"> * </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span> <span style="color: #008000"> * This software is subject to the Microsoft Public License (Ms-PL).  </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span> <span style="color: #008000"> * A copy of the license can be found in the license.htm file included  </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span> <span style="color: #008000"> * in this distribution. </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span> <span style="color: #008000"> * </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   9:</span> <span style="color: #008000"> * You must not remove this notice, or any other, from this software. </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  10:</span> <span style="color: #008000"> * </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  11:</span> <span style="color: #008000"> * ***************************************************************************/</span> </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  12:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  13:</span> <span style="color: #0000ff">namespace</span> System.Web.Mvc { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  14:</span>     <span style="color: #0000ff">using</span> System; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  15:</span>     <span style="color: #0000ff">using</span> System.Collections.Generic; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  16:</span>     <span style="color: #0000ff">using</span> System.Collections.Specialized; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  17:</span>     <span style="color: #0000ff">using</span> System.Diagnostics.CodeAnalysis; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  18:</span>     <span style="color: #0000ff">using</span> System.Globalization; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  19:</span>     <span style="color: #0000ff">using</span> System.Web.Mvc.Resources; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  20:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  21:</span>     [SuppressMessage(<span style="color: #006080">&quot;Microsoft.Usage&quot;</span>, <span style="color: #006080">&quot;CA2237:MarkISerializableTypesWithSerializable&quot;</span>, </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  22:</span>         Justification = <span style="color: #006080">&quot;It is not anticipated that users will need to serialize this type.&quot;</span>)] </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  23:</span>     [SuppressMessage(<span style="color: #006080">&quot;Microsoft.Design&quot;</span>, <span style="color: #006080">&quot;CA1035:ICollectionImplementationsHaveStronglyTypedMembers&quot;</span>, </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  24:</span>         Justification = <span style="color: #006080">&quot;It is not anticipated that users will call FormCollection.CopyTo().&quot;</span>)] </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  25:</span>     [FormCollectionBinder] </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  26:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> FormCollection : NameValueCollection { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  27:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  28:</span>         <span style="color: #0000ff">public</span> FormCollection() { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  29:</span>         } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  30:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  31:</span>         <span style="color: #0000ff">public</span> FormCollection(NameValueCollection collection) { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  32:</span>             <span style="color: #0000ff">if</span> (collection == <span style="color: #0000ff">null</span>) { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  33:</span>                 <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> ArgumentNullException(<span style="color: #006080">&quot;collection&quot;</span>); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  34:</span>             } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  35:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  36:</span>             Add(collection); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  37:</span>         } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  38:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  39:</span>         <span style="color: #0000ff">public</span> IDictionary&lt;<span style="color: #0000ff">string</span>, ValueProviderResult&gt; ToValueProvider() { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  40:</span>             CultureInfo currentCulture = CultureInfo.CurrentCulture; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  41:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  42:</span>             Dictionary&lt;<span style="color: #0000ff">string</span>, ValueProviderResult&gt; dict = <span style="color: #0000ff">new</span> Dictionary&lt;<span style="color: #0000ff">string</span>, ValueProviderResult&gt;(StringComparer.OrdinalIgnoreCase); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  43:</span>             <span style="color: #0000ff">string</span>[] keys = AllKeys; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  44:</span>             <span style="color: #0000ff">foreach</span> (<span style="color: #0000ff">string</span> key <span style="color: #0000ff">in</span> keys) { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  45:</span>                 <span style="color: #0000ff">string</span>[] rawValue = GetValues(key); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  46:</span>                 <span style="color: #0000ff">string</span> attemptedValue = <span style="color: #0000ff">this</span>[key]; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  47:</span>                 ValueProviderResult vpResult = <span style="color: #0000ff">new</span> ValueProviderResult(rawValue, attemptedValue, currentCulture); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  48:</span>                 dict[key] = vpResult; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  49:</span>             } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  50:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  51:</span>             <span style="color: #0000ff">return</span> dict; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  52:</span>         } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  53:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  54:</span>         <span style="color: #0000ff">public</span> <span style="color: #0000ff">virtual</span> ValueProviderResult GetValue(<span style="color: #0000ff">string</span> name) { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  55:</span>             <span style="color: #0000ff">if</span> (String.IsNullOrEmpty(name)) { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  56:</span>                 <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> ArgumentException(MvcResources.Common_NullOrEmpty, <span style="color: #006080">&quot;name&quot;</span>); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  57:</span>             } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  58:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  59:</span>             <span style="color: #0000ff">string</span>[] rawValue = GetValues(name); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  60:</span>             <span style="color: #0000ff">if</span> (rawValue == <span style="color: #0000ff">null</span>) { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  61:</span>                 <span style="color: #0000ff">return</span> <span style="color: #0000ff">null</span>; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  62:</span>             } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  63:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  64:</span>             <span style="color: #0000ff">string</span> attemptedValue = <span style="color: #0000ff">this</span>[name]; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  65:</span>             <span style="color: #0000ff">return</span> <span style="color: #0000ff">new</span> ValueProviderResult(rawValue, attemptedValue, CultureInfo.CurrentCulture); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  66:</span>         } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  67:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  68:</span>         <span style="color: #0000ff">private</span> <span style="color: #0000ff">sealed</span> <span style="color: #0000ff">class</span> FormCollectionBinderAttribute : CustomModelBinderAttribute { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  69:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  70:</span>             <span style="color: #008000">// since the FormCollectionModelBinder.BindModel() method is thread-safe, we only need to keep </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  71:</span>             <span style="color: #008000">// a single instance of the binder around </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  72:</span>             <span style="color: #0000ff">private</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">readonly</span> FormCollectionModelBinder _binder = <span style="color: #0000ff">new</span> FormCollectionModelBinder(); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  73:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  74:</span>             <span style="color: #0000ff">public</span> <span style="color: #0000ff">override</span> IModelBinder GetBinder() { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  75:</span>                 <span style="color: #0000ff">return</span> _binder; </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  76:</span>             } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  77:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  78:</span>             <span style="color: #008000">// this class is used for generating a FormCollection object </span></pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  79:</span>             <span style="color: #0000ff">private</span> <span style="color: #0000ff">sealed</span> <span style="color: #0000ff">class</span> FormCollectionModelBinder : IModelBinder { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  80:</span>                 <span style="color: #0000ff">public</span> <span style="color: #0000ff">object</span> BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext) { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  81:</span>                     <span style="color: #0000ff">if</span> (controllerContext == <span style="color: #0000ff">null</span>) { </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  82:</span>                         <span style="color: #0000ff">throw</span> <span style="color: #0000ff">new</span> ArgumentNullException(<span style="color: #006080">&quot;controllerContext&quot;</span>); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  83:</span>                     } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  84:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  85:</span>                     <span style="color: #0000ff">return</span> <span style="color: #0000ff">new</span> FormCollection(controllerContext.HttpContext.Request.Form); </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  86:</span>                 } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  87:</span>             } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  88:</span>         } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  89:</span>  </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  90:</span>     } </pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  91:</span> }</pre>
</p></div>
</div>
<p>The version of Mono 2.4.3 I have doesn&#8217;t compile the class FormCollection because the FormCollectionBinderAttribute is inside the FormCollection class.&#160; This is the bug, and it has since been fixed.&#160; Easy ways to get around this:</p>
<ol>
<li>Just use the binary assembly from Microsoft for ASP.NET MVC. </li>
<li>Build your own Mono with the fix included </li>
<li>Move the code for FormCollectionBinderAttribute class outside of the code for the FormCollection class. </li>
</ol>
<div class="zemanta-pixie"><img class="zemanta-pixie-img" alt="" src="http://img.zemanta.com/pixy.gif?x-id=f2ca890b-2b86-8d88-a1e6-06841221cc73" /></div>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2009/11/11/compiling-asp-net-mvc-on-mono-2-4-3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Common Service Locator</title>
		<link>http://www.opgenorth.net/2009/03/19/common-service-locator/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=common-service-locator</link>
		<comments>http://www.opgenorth.net/2009/03/19/common-service-locator/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 00:06:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2009/03/19/common-service-locator/</guid>
		<description><![CDATA[One of the nice things about Dependency Injection is that it can really help write a more flexible, modular application.&#160; These days, it seems that there is no shortage of choice in the .NET community when it comes to IoC frameworks: StructureMap Castle Windsor Ninject Autofac Unity Spring.NET And probably others that I’m missing. Ironically, [...]]]></description>
			<content:encoded><![CDATA[<p>One of the nice things about <a href="http://martinfowler.com/articles/injection.html">Dependency Injection</a> is that it can really help write a more flexible, modular application.&#160; These days, it seems that there is no shortage of choice in the .NET community when it comes to IoC frameworks:</p>
<ul>
<li><a href="http://structuremap.sourceforge.net">StructureMap</a> </li>
<li><a href="http://www.castleproject.org/container/index.html">Castle Windsor</a> </li>
<li><a href="http://www.ninject.org">Ninject</a> </li>
<li><a href="http://code.google.com/p/autofac/">Autofac</a> </li>
<li><a href="http://www.codeplex.com/unity">Unity</a> </li>
<li><a href="http://www.springframework.net/">Spring.NET</a> </li>
<li>And probably others that I’m missing. </li>
</ul>
<p>Ironically, when you first start using an IoC framework, you might find that in trying to make a loosely-coupled, modular, application you end up shackling yourself to the framework you’re using for IoC. </p>
<p>For example, you start off using your own homegrown IoC framework, and then decide at some point in the future to use a different framework, like say StructureMap.&#160; Going through your codebase to make these changes can be quite the exercise in pain.</p>
<p>There are a couple of ways to isolate yourself from this kind of situation.&#160; I won’t get into all of them but instead will focus on the <a href="http://www.codeplex.com/CommonServiceLocator">Common Service Locator</a>. What is Common Service Locator?&#160; Well, allow me to cut and paste some text from the web site:</p>
<p>&quot;<em>The Common Service Locator library contains a shared interface for service location which application and framework developers can reference. The library provides an abstraction over IoC containers and service locators. Using the library allows an application to indirectly access the capabilities without relying on hard references. The hope is that using this library, third-party applications and frameworks can begin to leverage IoC/Service Location without tying themselves down to a specific implementation.</em>”</p>
<p>Blah blah blah – so what does all that mean?&#160; Well, in my own words, CSL is basically a wrapper around your IoC container which separates how you&#160; initialize/configure your IoC container from how you use it.&#160; This separation allows you to use your IoC container without knowing anything about it.</p>
<p>This separation is achieved by use of adapters for the particular IoC container that you want to use.&#160; These adapters are what do the dirty work of finding the service you need, in their own special way and totally transparent from your application code.&#160; Currently, the Common Service Locator has adapters for <a href="http://www.codeplex.com/CommonServiceLocator/Wiki/View.aspx?title=StructureMap%20Adapter&amp;referringTitle=Home">StructureMap</a>, <a href="http://www.codeplex.com/CommonServiceLocator/Wiki/View.aspx?title=Castle%20Windsor%20Adapter&amp;referringTitle=Home">Castle Windows</a>, <a href="http://www.codeplex.com/CommonServiceLocator/Wiki/View.aspx?title=Unity%20Adapter&amp;referringTitle=Home">Unity</a>, <a href="http://www.codeplex.com/CommonServiceLocator/Wiki/View.aspx?title=Spring%20.NET%20Adapter&amp;referringTitle=Home">Spring.NET</a>, and <a href="http://www.codeplex.com/CommonServiceLocator/Wiki/View.aspx?title=Autofac%20Adapter&amp;referringTitle=Home">autofac</a>. </p>
<p>Now, allow me an example of using the Common Service Locator with StructureMap. There is no special reason as to why StructureMap – it just happens to be what I find myself using these days.</p>
<p>Now, say I use the the following <a href="http://structuremap.sourceforge.net/RegistryDSL.htm">registry</a> to configure StructureMap:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 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: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> <span style="color: #0000ff">public</span> <span style="color: #0000ff">class</span> DefaultStructureMapRegistry: Registry</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span> {</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">public</span> DefaultStructureMapRegistry()</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span>     {</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span>         ForRequestedType&lt;IDb4oConfiguration&gt;()</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span>             .TheDefaultIsConcreteType&lt;SimpleDb4oConfiguration&gt;();</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span>     }</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span> }</pre>
</p></div>
</div>
<p>In a nutshell this says that every time StructureMap is asked to provided an object of type IDb4oConfiguration, it should instantiate a SimpleDb4oConfiguration object and return that.&#160; So, to get an instance of IDb4oConfiguration with StructureMap, I would do something like this:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 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: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> var db4oConfig = ObjectFactory.GetInstance&lt;IDb4oConfiguration&gt;();</pre>
</p></div>
</div>
<p>Pretty simple, but it does kind of tightly couples me to StructureMap.&#160; If I need/feel like/am forced at gunpoint to change my IoC container to something that is Not StructureMap, you can bet that there will be much wailing and gnashing of teeth on my part as I hunt through my code to make these changes.</p>
<p>Now enter the Common Service Locator.&#160; First, let’s take a peek at some interfaces for CSL.&#160; First an interface:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 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: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> <span style="color: #0000ff">namespace</span> Microsoft.Practices.ServiceLocation</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span> {</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">interface</span> IServiceLocator : IServiceProvider</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span>     {</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span>         <span style="color: #0000ff">object</span> GetInstance(Type serviceType);</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span>         <span style="color: #0000ff">object</span> GetInstance(Type serviceType, <span style="color: #0000ff">string</span> key);</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span>         IEnumerable&lt;<span style="color: #0000ff">object</span>&gt; GetAllInstances(Type serviceType);</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span>         TService GetInstance&lt;TService&gt;();</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   9:</span>         TService GetInstance&lt;TService&gt;(<span style="color: #0000ff">string</span> key);</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  10:</span>         IEnumerable&lt;TService&gt; GetAllInstances&lt;TService&gt;();</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  11:</span>     }</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">  12:</span> }</pre>
</p></div>
</div>
<p>The IServiceLocator is an interface that your application will use when it requests something from your IoC container. </p>
<p>Another thing that CSL provides is a static class that your application would use to use a current IServiceLocator to request services.&#160; That static class looks something like:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 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: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> <span style="color: #0000ff">namespace</span> Microsoft.Practices.ServiceLocation</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span> {</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span>     <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">class</span> ServiceLocator</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span>     {</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   5:</span>         <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> IServiceLocator Current { get; }</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   6:</span>         <span style="color: #0000ff">public</span> <span style="color: #0000ff">static</span> <span style="color: #0000ff">void</span> SetLocatorProvider(ServiceLocatorProvider newProvider) {};</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   7:</span>     }</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   8:</span> }</pre>
</p></div>
</div>
<p>So, now lets see how we would request the default implementation of the IDb4oConfiguration service using CSL.&#160; First, we would initialize CSL:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 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: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> var registry = <span style="color: #0000ff">new</span> DefaultStructureMapRegistry();</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   2:</span> var container = <span style="color: #0000ff">new</span> global::StructureMap.Container(registry);</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   3:</span> var smServiceLocator = <span style="color: #0000ff">new</span> StructureMapServiceLocator(container);</pre>
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   4:</span> ServiceLocator.SetLocatorProvider(() =&gt; smServiceLocator );</pre>
</p></div>
</div>
<p>What is going on here? Allow me to provide a quick line by line explanation:</p>
<p>Line 1 we instantiate a new StructureMap registry.&#160; We then feed that registry to a StructureMap container in line 2.&#160; With line 3, we see that StructureMap container is then fed to the StructureMapServiceLocator, which is the SM adapter for the Common Service Locator.&#160; Finally, with line 4 we provide a lambda that CSL will use to fulfill future requests for services.</p>
<p>Now when our application wants to get an instance of IDb4oConfiguration it just politely asks CSL:</p>
<div style="border-bottom: gray 1px solid; border-left: gray 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: consolas, &#39;Courier New&#39;, courier, monospace; max-height: 200px; font-size: 8pt; overflow: auto; border-top: gray 1px solid; cursor: text; border-right: gray 1px solid; padding-top: 4px">
<div style="border-bottom-style: none; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; padding-left: 0px; width: 100%; padding-right: 0px; font-family: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px">
<pre style="border-bottom-style: none; 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: consolas, &#39;Courier New&#39;, courier, monospace; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px"><span style="color: #606060">   1:</span> var db4oConfig = ServiceLocator.Current.GetService&lt;IDb4oConfiguration&gt;();</pre>
</p></div>
</div>
<p>Pretty simple and clean, <a href="http://en.wikipedia.org/wiki/Eh#Canada">eh</a>?&#160; Now, when radical group the <em>Foundation for Unity as the Dominate IoC Container</em> sneaks into your cube and forces you at the point of a nerf gun to switch to Unity, you can do so with minimal disruption to your application. With a properly layered application, it would be as simple as coding a new UnityConfiguration layer and then using that instead of your StructureMapConfiguration layer on application startup.</p>
<p>Now, granted this is pretty trivialized example.&#160; There are other ways to solve this problem, but CSL does seem to take are of the grunt work for you so that you can just get going with things.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2009/03/19/common-service-locator/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TypeMock, TestDriven.NET, and Red Tests</title>
		<link>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=typemock-testdriven-net-and-red-tests</link>
		<comments>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests/#comments</comments>
		<pubDate>Sun, 19 Oct 2008 00:34:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests/</guid>
		<description><![CDATA[Lately I&#8217;ve been experimenting with TypeMock Isolator,&#160; and it&#8217;s new AAA syntax.&#160; For the past two years I&#8217;ve been a diehard Rhino.Mocks kind of guy, but figured that it&#8217;s time to check out other tools.&#160; Anyway, I had a situation where a unit test of mine was failing when I ran it with TestDriven.NET, but [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been experimenting with <a href="http://www.typemock.com/">TypeMock Isolator</a>,&#160; and it&#8217;s new AAA syntax.&#160; For the past two years I&#8217;ve been a diehard Rhino.Mocks kind of guy, but figured that it&#8217;s time to check out other tools.&#160; Anyway, I had a situation where a unit test of mine was failing when I ran it with <a href="http://www.testdriven.net/">TestDriven.NET</a>, but would pass when I ran it using the unit test runner in <a href="http://www.jetbrains.com/resharper">Resharper 4.1</a>.</p>
<p>Usually when I develop, I write individual tests and then run individually with TestDriven.NET and collectively with Resharper.&#160; In this case, as I was writing one unit test, it kept failing with TestDriven.NET.&#160; At first I thought it was just me being stupid (always a good place to start), and then I was worried that perhaps the documentation for TypeMock was to blame.&#160; So, I sent a email to Avi at TypeMock, mostly expecting confirmation of my stupidity.</p>
<p>Turns out the problem in this case was pretty obscure one (to me).&#160; At home, I do my development in a VM running Windows 2008 64 bit.&#160; When Resharper runs your unit tests, it does in a 32 bit process.&#160; TD.NET, on a 64bit OS,&#160; runs as a 64 bit process.&#160; If you get TD.NET to run as a 32 bit process, then your tests will run fine under TD.NET.</p>
<p>To do so, from the Visual Studio 2008 Command Prompt, change to the directory that you have TD.NET installed in.&#160; Then use corflags:</p>
<p><font face="Courier New">corflags /32bit+ ProcessInvocation.exe</font></p>
<p>Note that it&#8217;s probably best to do this when logged in as the Administrator.</p>
<p>I will say that I was happy with the support I got from the guys (Avi, Gil and Ohad) at TypeMock.&#160; Given the fact that we&#8217;re about a half a world apart (western Canada vs. Isreal), they provided prompt, excellent support.&#160; My thanks to them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TypeMock, TestDriven.NET, and Red Tests</title>
		<link>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests-2/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=typemock-testdriven-net-and-red-tests-2</link>
		<comments>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests-2/#comments</comments>
		<pubDate>Sat, 18 Oct 2008 07:05:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests-2/</guid>
		<description><![CDATA[Lately I&#8217;ve been experimenting with TypeMock Isolator,&#160; and it&#8217;s new AAA syntax.&#160; For the past two years I&#8217;ve been a diehard Rhino.Mocks kind of guy, but figured that it&#8217;s time to check out other tools.&#160; Anyway, I had a situation where a unit test of mine was failing when I ran it with TestDriven.NET, but [...]]]></description>
			<content:encoded><![CDATA[<p>Lately I&#8217;ve been experimenting with <a href="http://www.typemock.com/">TypeMock Isolator</a>,&#160; and it&#8217;s new AAA syntax.&#160; For the past two years I&#8217;ve been a diehard Rhino.Mocks kind of guy, but figured that it&#8217;s time to check out other tools.&#160; Anyway, I had a situation where a unit test of mine was failing when I ran it with <a href="http://www.testdriven.net/">TestDriven.NET</a>, but would pass when I ran it using the unit test runner in <a href="http://www.jetbrains.com/resharper">Resharper 4.1</a>.</p>
<p>Usually when I develop, I write individual tests and then run individually with TestDriven.NET and collectively with Resharper.&#160; In this case, as I was writing one unit test, it kept failing with TestDriven.NET.&#160; At first I thought it was just me being stupid (always a good place to start), and then I was worried that perhaps the documentation for TypeMock was to blame.&#160; So, I sent a email to Avi at TypeMock, mostly expecting confirmation of my stupidity. </p>
<p>Turns out the problem in this case was pretty obscure one (to me).&#160; At home, I do my development in a VM running Windows 2008 64 bit.&#160; When Resharper runs your unit tests, it does in a 32 bit process.&#160; TD.NET, on a 64bit OS,&#160; runs as a 64 bit process.&#160; If you get TD.NET to run as a 32 bit process, then your tests will run fine under TD.NET.</p>
<p>To do so, from the Visual Studio 2008 Command Prompt, change to the directory that you have TD.NET installed in.&#160; Then use corflags:</p>
<p>corflags /32bit+ ProcessInvocation.exe</p>
<p>Note that it&#8217;s probably best to do this when logged in as the Administrator.</p>
<p>I will say that I was happy with the support I got from the guys (Avi, Gil and Ohad) at TypeMock.&#160; Given the fact that we&#8217;re about a half a world apart (western Canada vs. Isreal), they provided prompt, excellent support.&#160; My thanks to them.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/10/18/typemock-testdriven-net-and-red-tests-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mono 2.0 Released</title>
		<link>http://www.opgenorth.net/2008/10/06/mono-2-0-released/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=mono-2-0-released</link>
		<comments>http://www.opgenorth.net/2008/10/06/mono-2-0-released/#comments</comments>
		<pubDate>Tue, 07 Oct 2008 00:32:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[mono]]></category>
		<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/10/06/mono-2-0-released/</guid>
		<description><![CDATA[I know it&#8217;s hard to beat my shocking announcement from a couple of days ago, but I feel that this one is even more important:&#160; Mono 2.0 has been released.&#160; Read the full details, go forth, and code.]]></description>
			<content:encoded><![CDATA[<p>I know it&#8217;s hard to beat my <a href="http://www.opgenorth.net/2008/10/09/where-windows-beats-linux/">shocking announcement</a> from a couple of days ago, but I feel that this one is even more important:&#160; Mono 2.0 has been released.&#160; <a href="http://www.mono-project.com/Release_Notes_Mono_2.0">Read the full details</a>, go forth, and code.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/10/06/mono-2-0-released/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>What&#8217;s In A Name?</title>
		<link>http://www.opgenorth.net/2008/08/26/whats-in-a-name/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=whats-in-a-name</link>
		<comments>http://www.opgenorth.net/2008/08/26/whats-in-a-name/#comments</comments>
		<pubDate>Wed, 27 Aug 2008 01:28:00 +0000</pubDate>
		<dc:creator>tom</dc:creator>
				<category><![CDATA[.NET]]></category>
		<category><![CDATA[MVC]]></category>

		<guid isPermaLink="false">http://www.opgenorth.net/2008/08/26/whats-in-a-name/</guid>
		<description><![CDATA[As I was driving home today, I couldn&#8217;t help notice something.&#160; Microsoft&#8217;s ASP.NET MVC framework is still in beta, and was only announced last October.&#160; To my knowledge, there are currently three projects in the Edmonton area based off this framework. Castle Monorail has been around for much longer, three years or so?&#160; It&#8217;s still [...]]]></description>
			<content:encoded><![CDATA[<p>As I was driving home today, I couldn&#8217;t help notice something.&#160; Microsoft&#8217;s ASP.NET MVC framework is still in beta, and was only announced last October.&#160; To my knowledge, there are currently three projects in the <a href="http://maps.google.ca/maps?q=Edmonton,+Alberta&amp;ie=UTF8&amp;oe=utf-8&amp;client=firefox-a&amp;ll=53.540307,-113.510742&amp;spn=18.606218,57.128906&amp;z=5&amp;iwloc=addr">Edmonton</a> area based off this framework.</p>
<p>Castle Monorail has been around for much longer, three years or so?&#160; It&#8217;s still listed as a release candidate on it&#8217;s website, but I&#8217;d say Monorail is suitable for production.&#160; Currently, I am not aware of any projects in the Edmonton that are based off this framework.</p>
<p>I guess this is anecdotal evidence that you won&#8217;t get fired for sticking with Microsoft. <img src='http://www.opgenorth.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The two frameworks have quite a few similarities.&#160; IIRC, in Austin last fall Scott Guthrie did mention that the ASP.NET MVC framework was influenced to some degree by Monorail.</p>
<p>Regardless, it&#8217;s good news.&#160; Personally, I like both frameworks, and would prefer either of them to Web Forms.&#160; YMMV.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.opgenorth.net/2008/08/26/whats-in-a-name/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

