<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:atom="http://www.w3.org/2005/Atom" xmlns:openSearch="http://a9.com/-/spec/opensearch/1.1/" xmlns:georss="http://www.georss.org/georss" xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr="http://purl.org/syndication/thread/1.0" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><atom:id>tag:blogger.com,1999:blog-1759021816486600143</atom:id><lastBuildDate>Thu, 19 Jan 2012 19:50:45 +0000</lastBuildDate><category>Mocking</category><category>MVC</category><category>javascript</category><category>Teamwork</category><category>ICSharpZip</category><category>System Architecture</category><category>Cloud Computing</category><category>Podcast</category><category>Best Practices</category><category>Refactoring</category><category>Visual Studio 2010</category><category>extension methods</category><category>Pair Programing</category><category>ASP.NET</category><category>Blogging</category><category>Amazon Web Services</category><category>Heros</category><category>C#</category><category>Development</category><category>Sample Code Repository</category><category>Data Access</category><category>TDD</category><category>WMI</category><category>Telerik</category><category>New Look</category><category>WCF</category><category>project completion dates</category><category>Tools</category><category>Code-Camp</category><category>IOC</category><category>Mono</category><category>Documentation</category><category>Jquery</category><category>Zip Files</category><category>Design Patterns</category><category>Fundamentals</category><category>Continues Integration</category><category>.NET</category><title>The janitor's closet</title><description>The random rantings of a PERL Unix/Linux geek turned .NET Developer, and it all started with mono</description><link>http://bob-the-janitor.blogspot.com/</link><managingEditor>noreply@blogger.com (Bob The Janitor (Richard))</managingEditor><generator>Blogger</generator><openSearch:totalResults>50</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/TheJanitorsCloset" /><feedburner:info uri="thejanitorscloset" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId>TheJanitorsCloset</feedburner:emailServiceId><feedburner:feedburnerHostname>http://feedburner.google.com</feedburner:feedburnerHostname><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1636228500647595309</guid><pubDate>Thu, 19 Jan 2012 19:50:00 +0000</pubDate><atom:updated>2012-01-19T12:50:45.123-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Continues Integration</category><category domain="http://www.blogger.com/atom/ns#">Tools</category><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><title>Automated Builds and Continuous Integration with Jenkins</title><description>&lt;p&gt;The concept of an automated build is fairly basic, you simply take your existing build file (make, nant, ant, msbuild(.sln), rake) and set up a service to build it from your source control repository.&amp;#160; &lt;/p&gt;  &lt;h4&gt;Automating builds &lt;/h4&gt;  &lt;p&gt;Setting up automated builds provide a number of advantages:&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Everything your project needs to build and run is checked into source control. &lt;/li&gt;    &lt;li&gt;By scripting your builds you remove human error problems, computers are just better at running repetitive tasks &lt;/li&gt;    &lt;li&gt;Logging what was done and when it was done. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;At a former employer the marketing department needed to do content updates on a fairy regular basis; So they wouldn’t have to wait for us, I set them up with svn for the content directory and created some users for content deployment.&amp;#160; All they had to do was update the content and commit it and then deploy it.&amp;#160; We where happy because we didn’t need to spend time on their deployments, and they where happy because they could push content any time they wanted to. &lt;/p&gt;  &lt;h4&gt;Continuous Integration&amp;#160; &lt;/h4&gt;  &lt;p&gt;This is a key part of doing Test Driven Development, making sure your tests are run when checked in.&amp;#160; This makes sure that all of the tests are working in the build environment, and lets everyone know when there is a problem as soon as the build runs, and lets the developer responsible to fix it as soon as possible, creating an over all better code quality.&amp;#160; &lt;/p&gt;  &lt;h4&gt;Using Jenkins&lt;/h4&gt;  &lt;p&gt;Jenkins is an open source Build server forked from the Hudson project, basically when Oracle bought Sun/Java some of the Hudson team decided to was time to go their own way.&amp;#160; Jenkins Benefits from a log history of community support from it’s Hudson days allowing it to be a very mature and extendable system.&amp;#160; Having said that, it not as easy to use as some other build servers (see &lt;a href="http://bob-the-janitor.blogspot.com/2009/04/continues-integration-with-team-city.html"&gt;Continues Integration with TeamCity&lt;/a&gt;) but what it lacks in ease of use, it makes up for in versatility and flexibility.&lt;/p&gt;  &lt;h5&gt;User Management&lt;/h5&gt;  &lt;p&gt;Like most things in Jenkins User management is very flexible by default supporting LDAP, it’s own internal user DB, delegate to servlet container, and has a huge list of user management plug-ins for everything from Active Directory to GitHub OAuth.&amp;#160; Once the user is added you also have a fairly flexible authorization set up&amp;#160; from allowing anyone to do anything to completely locking it down.&amp;#160; &lt;/p&gt;  &lt;p&gt;My biggest complaint here is that by default everything is wide open and the responsibility of locking everything down is placed on the administrator.&lt;/p&gt;  &lt;h5&gt;Build Jobs&lt;/h5&gt;  &lt;p&gt;By default Jenkins supports Maven2/3, completely rolling your own multi part build, and Monitoring an external job but&amp;#160; with a large selection of plug-ins supporting everything from rake to powershell to Fitness, to an Android Emulator.&lt;/p&gt;  &lt;p&gt;Rolling your own multi part build is fairly strait forward if a little involved with a lot of the basic options you would expect like wither to keep old builds, how long do you want to keep them, how many do you keep, Quiet period, retry count, etc.&lt;/p&gt;  &lt;p&gt;With it’s plug-ins your source control provider options are just about anything you can think of including:SVN, CSV, Git, ClearCase, etc. The same for build triggers by default it supports build after other projects, build periodically(nightly builds for example), pull scm, and remote triggering(call a url with an auth token to start a build).&lt;/p&gt;  &lt;p&gt;When your done with your build you have built in support to ftp or ssh your build results with plug-ins to do everything from upload to &lt;a href="http://aws.amazon.com/s3/"&gt;Amazon S3&lt;/a&gt; to the &lt;a href="http://www.appaloosa-store.com/"&gt;Appaloose Store&lt;/a&gt; for mobile apps.&lt;/p&gt;  &lt;p&gt;The down side to all of this flexibility is you are forced to do a lot for the configuration your self, unlike &lt;a href="http://www.jetbrains.com/teamcity/"&gt;TeamCity&lt;/a&gt;, if you want your code test results published you have to configure it yourself, if you want your code coverage results, you have to configure it to use something like &lt;a href="http://sourceforge.net/projects/partcover/"&gt;PartCover&lt;/a&gt; yourself. &lt;/p&gt;  &lt;h5&gt;Reporting&lt;/h5&gt;  &lt;p&gt;Just as important as automating your builds is knowing what is going on with them, when are they running, did it fail, what failed, etc.&amp;#160; Jenkins has fairly nice tools built in to show you what is going on.&amp;#160; With a build history trend report, rss feeds, Email notification, and plug-ins to support everything from dashboard views to creating a Wall friendly display of all build jobs.&lt;/p&gt;  &lt;h4&gt;Conclusion &lt;/h4&gt;  &lt;p&gt;While not as nice to set up and manage as some other build servers, Jenkins is incredibly powerful with a lot of flexibly, and to be honest it’s really hard to complain about an enterprise level build server for free.&amp;#160; I would make the comparison between running Linux VS. Windows servers, Windows may be more polished but it’s not as flexible.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-1636228500647595309?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vC23HESStW-Tu7nLqHmItBhTYxQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vC23HESStW-Tu7nLqHmItBhTYxQ/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vC23HESStW-Tu7nLqHmItBhTYxQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vC23HESStW-Tu7nLqHmItBhTYxQ/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/-79MXgCnVOY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/-79MXgCnVOY/automated-builds-and-continuous.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2012/01/automated-builds-and-continuous.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1332094654226316679</guid><pubDate>Mon, 09 Jan 2012 05:28:00 +0000</pubDate><atom:updated>2012-01-08T22:34:12.832-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tools</category><category domain="http://www.blogger.com/atom/ns#">Development</category><title>Finally decided to do a dev tools list</title><description>One of the most important parts of being a craftsman is your selection of tools, it doesn’t matter if you are a carpenter, a mason, cabinet maker, or even a software developer, your tools allow you to get the work done.&amp;nbsp;&amp;nbsp; What tools you use really depends on your style and technique and may very greatly depending on the person.&amp;nbsp; This is a simple list of IDEs, editors, libraries, etc. that I like and work for me, some are pay for, most are not.&amp;nbsp; This isn't a complete list of the tools I use but it's a good solid overview of what I use on a day to day basis, take a look and see what you like, or don’t.&lt;br /&gt;
&lt;h4&gt;
IDEs&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.microsoft.com/visualstudio/en-us" target="_blank"&gt;Visual Studio 2010&lt;/a&gt; – The default editor for doing .NET development, it has it’s share of problems but for the most part it a very sold IDE. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://monodevelop.com/" target="_blank"&gt;MonoDevelop&lt;/a&gt; – This is where .NET started for me 8 years ago, not a lot of frills, but for a fully functional cross platform IDE for .NET the price is right at free, unless you want to do Android or IOS, then you need to buy monoDroid or monoTouch. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://netbeans.org/" target="_blank"&gt;NetBeans&lt;/a&gt; – My go to java and PHP IDE, with good intellisense and built in refactoring tools.&amp;nbsp; &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Visual Studio Plugins&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.jetbrains.com/resharper/" target="_blank"&gt;Resharper&lt;/a&gt; – The most valuable IDE plugin I have ever used, providing nUnit support, refactoring, add reference, and the list keeps going.&amp;nbsp; I honestly have a hard time using Visual Studio with out it. &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.jetbrains.com/dotcover/" target="_blank"&gt;DotCover&lt;/a&gt; – An important part of test driven development is code coverage, and DotCover is my coverage tool of choice.&amp;nbsp; It integrates with Resharper’s test runner to provide on request code coverage in the IDE. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Source Control&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://ankhsvn.open.collab.net/" target="_blank"&gt;AnkhSVN&lt;/a&gt; – Provides SVN support for Visual Studio, so far this is the best free SVN plugin I have found for Visual Studio &lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.visualsvn.com/server/" target="_blank"&gt;Visual SVN server&lt;/a&gt; – A simple and easy SVN server that just works, it may not have a lot of bells and whistles but it’s easy to install and manage users. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Text Editors&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://notepad-plus-plus.org/" target="_blank"&gt;Notepad++&lt;/a&gt; – One of the first things I do on any new windows system is install Notepad++, it integrates with Windows explorer making it simple to edit any text file with out having to deal with what the default app is for the ext. with a huge list of plugins for everything from XML to powershell it is the Swiss Army Knife of text editors. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
SQL Tools&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://toadforsqlserver.com/index.jspa" target="_blank"&gt;Toad For SQL Server&lt;/a&gt; – This is a new item on my tools list, I just started using it this week, but I really like it.&amp;nbsp; The community version has some really nice intellisense, and the way the UI works is just clean.&amp;nbsp; I’m really interested in seeing a head to head comparison between Redgate’s SQL Tool belt and Toad Development Suite for SqlServer, the features look about the same, but at around $1,300 vs. $2,000 toad is a lot cheaper. &lt;/li&gt;
&lt;li&gt;&lt;a href="https://github.com/schambers/fluentmigrator" target="_blank"&gt;FluentMigriator&lt;/a&gt; – A .NET version of the Ruby Migrations tool.&amp;nbsp; With a fairly simple syntax and helpers it makes scripting DB changes easy, to read more check out this blog post I did a little while ago, &lt;a href="http://bob-the-janitor.blogspot.com/2011/07/using-fluentmigrator-with-nant.html" target="_blank"&gt;Using Fluentmigrator with nant&lt;/a&gt;. &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Unit Testing&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.nunit.org/" target="_blank"&gt;NUnit&lt;/a&gt; – The work horse of the .NET unit testing world.&amp;nbsp; It’s a solid testing framework with some of the best tool support out there, with the exception if Visual Studio, but Resharper fixes that.&lt;/li&gt;
&lt;li&gt;&lt;a href="http://code.google.com/p/moq/" target="_blank"&gt;Moq&lt;/a&gt; – The Simplest mocking framework for .NET.&amp;nbsp; With a clean fluent syntax that provides ease of use and versatility.&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/li&gt;
&lt;/ul&gt;
&lt;h4&gt;
Build And CI Server&lt;/h4&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://www.jetbrains.com/teamcity/" target="_blank"&gt;Team City&lt;/a&gt; – By far the easiest to get set up and start running with.&amp;nbsp; With built in support for most of the tools I use and has DotCover built in, it provides a solid solution out of the box with a very polished UX.&amp;nbsp; &lt;/li&gt;
&lt;li&gt;&lt;a href="http://jenkins-ci.org/" target="_blank"&gt;Jenkins&lt;/a&gt; – A fork of the Hudson project, Jenkins is a solid if less then polished build and CI server solution, but what it lacks in polish it makes up in versatility and flexibility, with a huge selection of plugins for integrating into just about development environment and deploying to just about any other system out there.&lt;/li&gt;
&lt;/ul&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-1332094654226316679?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wcfGepgBDiBcN2i610D6kfD4wx8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wcfGepgBDiBcN2i610D6kfD4wx8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wcfGepgBDiBcN2i610D6kfD4wx8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wcfGepgBDiBcN2i610D6kfD4wx8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/t-YCBd7cu4I" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/t-YCBd7cu4I/finally-decided-to-do-dev-tools-list.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2012/01/finally-decided-to-do-dev-tools-list.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4637900175115166116</guid><pubDate>Thu, 05 Jan 2012 21:09:00 +0000</pubDate><atom:updated>2012-01-19T08:26:41.159-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Test Driven Development for the management point of view</title><description>&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
When I have given presentations on TDD, one of the biggest questions
I get is “How do I sell this to my boss?”, and it’s a very valid question, you
are basically asking your boss to let you write 2-3x as much code to make sure
the code you wrote is correct, that’s a tough sell all on its own.&amp;nbsp; Software can never be done soon enough, most
projects are already behind from the start, and now you want to take more time
to write more code?&amp;nbsp; &lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoSubtitle"&gt;
&lt;b&gt;Time is Money&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
There is a cost to Test Driven Development (TDD), you are
doing more work, writing tests takes time, maintaining tests takes time, and
running tests takes time.&amp;nbsp; With time equaling
money the question is “what are you buying?”, the simple answer is security,
and long term cost reducion.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Ever wonder what it would be like to have a car without a
check engine light?&amp;nbsp; For the most part it’s
something most of us never look at.&amp;nbsp; When
it turns on we take it to the shop and the mechanic fixes whatever is wrong. &amp;nbsp;Without the check engine light to tell you something
is wrong, what could have been a small repair is now an engine rebuild.&amp;nbsp; Having test provides you with the same thing,
it lets you know there is a problem before it becomes a larger problem, this
could be inconsistent application behavior, data corruption, or the application
crashing.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;strong&gt;&lt;span style="font-family: Calibri, sans-serif;"&gt;Real world example&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span class="MsoSubtleEmphasis"&gt;&lt;i&gt;At a former employer we were
migrating to a new production database for our flagship application, the database
it’s self was a very complex system, lots of tables, triggers, stored procedures,
etc. &amp;nbsp;&amp;nbsp;The DBA migrated the schema to the
new server, got a snapshot of the data and then ran our integration tests and
had failures everywhere, invalid permissions, missing columns, etc. &amp;nbsp;Even using the failed tests as a road map to
took the DBAs 1 ½ days to fix all of the problems.&amp;nbsp; I can’t even guess how long it would have
taken to fix if we would have just done to production, on top of that the
company’s main product would have been down, not only affecting us, but also
all of our customers that depended on our product to run their businesses. &amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span class="MsoSubtleEmphasis"&gt;&lt;i&gt;&lt;br /&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
We Could have just blamed the DBA for not getting everything
right the first time, but at the same time, how much time was he given to do
it, would it have been cost effective to spend more time for this one time, verses
spending the time writing tests that can test it over and over again.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoSubtitle"&gt;
&lt;b&gt;Spending a little to save a lot&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Software bugs have costs: they cost to find, they cost to
track, they cost to fix, they cost to verify when fixed, and they cost to push
out the fix.&amp;nbsp;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="text-indent: -0.25in;"&gt;Cheap - A developer finds a bug when it was written,
he/she fixes it, very little cost&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="text-indent: -0.25in;"&gt;More Expensive - QA finds the bug, the tester
needs to make sure it’s an actual bug, retest to verify how to reproduce it,
then records it a bug report, sends the bug report to the developer, the
developer fixes the bug, send the fix back to QA, it’s retested, then the bug
report is closed.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="font-family: Symbol; text-indent: -0.25in;"&gt;&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-indent: -0.25in;"&gt;Very Expensive – User finds bug, contacts
customer service, customer service sends bug to QA, QA verifies the bug,
creates a bug report, developer fixes bug, sends the fix to QA, QA verify bug
is fixed, bug fix is redeployed to production.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
How much the bug costs depends on how soon it’s discovered,
the sooner it’s discovered, the less people touch it and the less it costs.&amp;nbsp; By writing tests developers are far more
likely to find bugs sooner also nothing is more frustrating than having bugs reappear,
manually retesting existing functionality takes time, and increases QA cost,
also reduces the time QA has to find new bugs, and edge case bugs.&amp;nbsp; TDD inherently provides regression testing
and can greatly reduce your QA time. &amp;nbsp;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;strong&gt;&lt;span style="font-family: Calibri, sans-serif;"&gt;Real world example&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span class="MsoSubtleEmphasis"&gt;&lt;i&gt;At one time I worked as a QA Engineer
at a major printer company, a little over half my time was spent not only
testing new functionality, but existing functionality as well, the rest of my
time was spent sending bug reports to the developers, having the developers
asking for clarification, verifying the bug was fixed, etc. &amp;nbsp;&amp;nbsp;&amp;nbsp;As
much as it cost for me to test a printer, the cost of having a driver or even
worse a firmware bug get released to the customer where astronomical.&amp;nbsp; By reducing the time I had to spend retesting
and verifying bugs, I could spend more time looking for edge case bugs.&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span class="MsoSubtleEmphasis"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Something else to think about it unlike web development where
you are only pushing code to your servers, having hardware in the hands of
consumers with a bug requires the add cost of service representatives, service techs,
etc.&amp;nbsp; &amp;nbsp;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoSubtitle"&gt;
&lt;b&gt;Reducing Costs by building on a well build foundation&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
TDD by it nature encourages good development practices, by
breaking up chunks of code into more testable sections, you are turning them
into more manageable pieces; this reduces the amount of time and effort required
to update and maintain your application and greatly reducing the need for the
dreaded rewrite.&amp;nbsp;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Ask any construction contractor what makes the biggest difference
on a building remodel, and they are probably going to tell you “How well the original
building was built”.&amp;nbsp; If the foundation
isn’t level or the walls aren’t straight, it’s going to make his job that much
harder having to compensate for the existing structure.&amp;nbsp; The same thing applies to software
development, the less old code that needs to change to add new features, the
less it costs to add new feature with the added bonus of the tests telling you
where your changes affect the rest of the application.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;strong&gt;&lt;span style="font-family: Calibri, sans-serif;"&gt;Real world example&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span class="MsoSubtleEmphasis"&gt;&lt;i&gt;I wor&lt;span style="font-family: inherit;"&gt;ked on a project that was
needed to replace how users authenticated; the user still entered a user name
and password, b&lt;/span&gt;ut how they were verified need to be updated for security reasons.&amp;nbsp; By having the application broken up, all that
needed to be changed is adding the new authentication code and changing one
line in the existing code to implement the new functionality.&lt;/i&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;span class="MsoSubtleEmphasis"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;span style="font-family: inherit; font-size: 11pt; line-height: 115%;"&gt;Using
TDD isn't required to use these best practices, but trying to do TDD without
using them is painful to next to impossible.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-4637900175115166116?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/I4i5mFBPEML4KQhxfxGph1SL_M0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/I4i5mFBPEML4KQhxfxGph1SL_M0/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/I4i5mFBPEML4KQhxfxGph1SL_M0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/I4i5mFBPEML4KQhxfxGph1SL_M0/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/JxKWDHo4etc" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/JxKWDHo4etc/test-driven-development-from-management.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2012/01/test-driven-development-from-management.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4279557173035583731</guid><pubDate>Sun, 27 Nov 2011 10:55:00 +0000</pubDate><atom:updated>2011-11-27T04:03:56.516-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">MVC</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Jquery</category><title>More Ajax with MVC – Using Partial Views with Ajax</title><description>One the the really nice features in asp.net mvc is the ability to use partial views, not only for breaking up pages and reusing content but also for doing Ajax calls.&amp;nbsp; In &lt;a href="http://bob-the-janitor.blogspot.com/2010/12/easy-ajax-with-aspnet-mvc-and-jquery.html" target="_blank"&gt;Easy Ajax with ASP.NET MVC and jQuery&lt;/a&gt; I showed you how to do a basic Ajax call and display the data returned, now I’m going to show you something a little more useful, actually retuning content to display on the page.&lt;br /&gt;
First we take this partial view &lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;
&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; @using SampleApplication.Models&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; @model PartialModel&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;div&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;     @Model.Text&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;div&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;input&lt;/span&gt; &lt;span style="color: red;"&gt;type&lt;/span&gt;&lt;span style="color: blue;"&gt;="button"&lt;/span&gt; &lt;span style="color: red;"&gt;value&lt;/span&gt;&lt;span style="color: blue;"&gt;="click me"&lt;/span&gt; &lt;span style="color: red;"&gt;onclick&lt;/span&gt;&lt;span style="color: blue;"&gt;="UpdateView();return false;"&lt;/span&gt;&lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Then we add it to the main view like this&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;
&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;div&lt;/span&gt; &lt;span style="color: red;"&gt;id&lt;/span&gt;&lt;span style="color: blue;"&gt;="UpdateableContent"&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt;     @{ Html.RenderPartial("Partial",new PartialModel{Text = "Before Clicked"}); }&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon;"&gt;div&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
Next we need to have a Action to call that returns the rendered view with updates&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;
&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; public ActionResult UpdatePartial()&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     var model = new PartialModel() {Text = "was updated"};&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     return View("Partial", model);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
In this case we update the model and return the specified partial view with the updated model.&lt;br /&gt;
&lt;br /&gt;
Last we have the Javascript that makes the Ajax call&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 200px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;
&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; function UpdateView() {&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt;     var model = { };&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     $.post("/home/UpdatePartial",&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;         model,&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;         function (data) {&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;             $("#UpdateableContent").html(data);&lt;/pre&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;         });&lt;/pre&gt;
&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt; }&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
it’s fairly simple and a lot like what we did in the Easy Ajax post, the major difference is we take the returned rendered partial view and replace the existing rendering of the partial view using JQuery’s .html(),&amp;nbsp; this replaces the existing content with the passed in content. &amp;nbsp;This is a very simple and effective way to manipulate your pages.&lt;br /&gt;
&lt;br /&gt;
As always here is the &lt;a href="http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/SampleApplication/SampleApplication/" target="_blank"&gt;source code&lt;/a&gt; for a sample project using it&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-4279557173035583731?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/H8msFqRARveirblA_oBo7fUvHvI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H8msFqRARveirblA_oBo7fUvHvI/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/H8msFqRARveirblA_oBo7fUvHvI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H8msFqRARveirblA_oBo7fUvHvI/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/crE1XzEg7P0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/crE1XzEg7P0/more-ajax-with-mvc-using-partial-views.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2011/11/more-ajax-with-mvc-using-partial-views.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4742290714164384075</guid><pubDate>Sun, 17 Jul 2011 05:38:00 +0000</pubDate><atom:updated>2011-07-19T17:22:26.466-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Data Access</category><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><title>Using FluentMigrator with nAnt</title><description>On a project I was working on a while ago, we all had local copies of the DB in versioned .sql files, and then every time we did an update we would run the sql in the DB files and hope it build the DB.&lt;br /&gt;
More often then not it would blow up and so I would spend the first 1/2 hour every time I worked on the project getting things to work again. Well no more!&amp;nbsp; &lt;br /&gt;
FluentMigrator is based on Ruby Migrations, with a fairly simple syntax. The db classes have the attribute [Migration()] that specifies the version, and inherit from the Migration class, and override the two methods Up and Down.&lt;br /&gt;
&lt;style type="text/css"&gt;
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.codebox {
border: solid 1px black;
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;  &lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; [Migration(20110624232410)]&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; AddUserTables : Migration&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Up()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;         Create.Table(&lt;span style="color: #006080;"&gt;"Users"&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;             .WithColumn(&lt;span style="color: #006080;"&gt;"Id"&lt;/span&gt;).AsInt32().Identity().NotNullable()&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;             .WithColumn(&lt;span style="color: #006080;"&gt;"Name"&lt;/span&gt;).AsString().NotNullable()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;             .WithColumn(&lt;span style="color: #006080;"&gt;"Password"&lt;/span&gt;).AsAnsiString().NotNullable();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Down()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;         Delete.Table(&lt;span style="color: #006080;"&gt;"Users"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;h5&gt;&lt;b&gt;Migrating Up and Down&lt;/b&gt;&lt;/h5&gt;The Reason for the Up and Down methods is very simple; if the version your migrating to is higher then the version of this class it executes the code in the Up method and if the version is lower then the code in the Down method executes.&amp;nbsp; Basically whatever you do in the Up is undone in the Down.&lt;br /&gt;
&lt;h5&gt;&lt;b&gt;Setting The Version Number&lt;/b&gt;&lt;/h5&gt;Something else you may have noticed is in the Migration tag the version number is fairly large, to make versioning easier on a team, I’m not using consecutive numbers but the date and time(using 24 hour time) of when the I added this class, so the the example class I created was on 6/24/2011 at 23:24 10. The current version number is also stored in the DB, making it very simple to see what DB version you’re on, this can come in handy if your code is based on a specific DB version you can do a simple check to see if you have the correct DB version.&lt;br /&gt;
&lt;h5&gt;Keeping version iterations small&lt;/h5&gt;Just like when creating a business logic class, you should follow the single responsibility principal, and have each class do only one thing, this may mean having a lot of classes but on the other side it will make it a lot easier to keep track of what each version added, modified, or removed.&lt;br /&gt;
&lt;h5&gt;Adding stuff to the Data Base&lt;/h5&gt;Using the Fluent api allows you to very smoothly add tables, columns etc. in a very readable way.&amp;nbsp; If you look at the Up method in the above example you can see how easy it is to add a table with columns.&amp;nbsp; This makes it very easy to add your own extension methods to short had it even further.&amp;nbsp; Here is an example for creating an identity column and a table with time stamps:&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;br /&gt;
&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; internal &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; MigrationExtensions&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; ICreateTableColumnOptionOrWithColumnSyntax WithIdColumn(this ICreateTableWithColumnSyntax tableWithColumnSyntax)&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;         &lt;span style="color: blue;"&gt;return&lt;/span&gt; tableWithColumnSyntax&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;             .WithColumn(&lt;span style="color: #006080;"&gt;"Id"&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;             .AsInt32()&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;             .NotNullable()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;             .PrimaryKey()&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;             .Identity();&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; ICreateTableColumnOptionOrWithColumnSyntax WithTimeStamps(this ICreateTableWithColumnSyntax tableWithColumnSyntax)&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;         &lt;span style="color: blue;"&gt;return&lt;/span&gt; tableWithColumnSyntax&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;             .WithColumn(&lt;span style="color: #006080;"&gt;"CreatedAt"&lt;/span&gt;).AsDateTime().NotNullable()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;             .WithColumn(&lt;span style="color: #006080;"&gt;"ModifiedAt"&lt;/span&gt;).AsDateTime().NotNullable();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;But the api doesn't have everything you need so you have the option of adding in strait sql using Execute.Sql(). like this example:&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; Execute.Sql(&lt;span style="color: #006080;"&gt;"DELETE FROM `Users` WHERE Name = 'TestUser'"&lt;/span&gt;);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;also you can call sql files like this:&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; Execute.Script(&lt;span style="color: #006080;"&gt;"myscript.sql"&lt;/span&gt;);&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;h5&gt;Adding Data&lt;/h5&gt;The next step is to add some data. This could be some sample data for development, a larger dataset for QA, QA data for a specific type of customer, or base data for production.&amp;nbsp; By adding profiles you can abstract away what data you want to add for specific function. This is not where you add data for things the should be constant, things like lookup tables should be handled by a versioned migration class.&amp;nbsp; Here is an example of a profile class:&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; [Profile(&lt;span style="color: #006080;"&gt;"Development"&lt;/span&gt;)]&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; DevelopmentProfile : Migration&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Up()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;             &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;         Insert.IntoTable(&lt;span style="color: #006080;"&gt;"Users"&lt;/span&gt;).Row(&lt;span style="color: blue;"&gt;new&lt;/span&gt; {Name = &lt;span style="color: #006080;"&gt;"TestUser"&lt;/span&gt;, Password=&lt;span style="color: #006080;"&gt;"12345"&lt;/span&gt;});&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Down()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;         Execute.Sql(&lt;span style="color: #006080;"&gt;"DELETE FROM `Users` WHERE Name = 'TestUser'"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;Just like a Version class it inherits from the Migration class and has an up and a down method, this way when you add one profile it will remove the other profiles. &lt;br /&gt;
&lt;h5&gt;Deploying/Migrating Your Data Base&lt;/h5&gt;Deploying or Migrating your data can be done with a console app or with a build runner like MSBuild, nAnt, or Rake making it easy to integrate into your existing build process.&amp;nbsp; For this example we are going to use nAnt.&amp;nbsp; Here is an example nAnt build file:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: maroon;"&gt;xml&lt;/span&gt; &lt;span style="color: red;"&gt;version&lt;/span&gt;&lt;span style="color: blue;"&gt;="1.0"&lt;/span&gt; &lt;span style="color: red;"&gt;encoding&lt;/span&gt;&lt;span style="color: blue;"&gt;="UTF-8"&lt;/span&gt; ?&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;project&lt;/span&gt; &lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="FluentMigratorProof"&lt;/span&gt; &lt;span style="color: red;"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue;"&gt;="http://nant.sourceforge.net/release/0.90/nant.xsd"&lt;/span&gt; &lt;span style="color: red;"&gt;default&lt;/span&gt;&lt;span style="color: blue;"&gt;="migrate-Production"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;   &amp;lt;&lt;span style="color: blue;"&gt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;loadtasks&lt;/span&gt; &lt;span style="color: red;"&gt;assembly&lt;/span&gt;&lt;span style="color: blue;"&gt;="./FluentMigrator.NAnt.dll"&lt;/span&gt; &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;   &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;target&lt;/span&gt; &lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="Reset"&lt;/span&gt; &lt;span style="color: red;"&gt;description&lt;/span&gt;&lt;span style="color: blue;"&gt;="Migrate the database to the base version"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;     &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;migrate&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;     &lt;span style="color: red;"&gt;database&lt;/span&gt;&lt;span style="color: blue;"&gt;="sql"&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;     &lt;span style="color: red;"&gt;connection&lt;/span&gt;&lt;span style="color: blue;"&gt;="Data Source=DevBOX\SQLEXPRESS;Initial Catalog=FluentMigratorProof;User Id=BuildUser;Password=xxxxxxx;"&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;     &lt;span style="color: red;"&gt;namespace&lt;/span&gt;&lt;span style="color: blue;"&gt;="FluentMigratorProof"&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;     &lt;span style="color: red;"&gt;target&lt;/span&gt;&lt;span style="color: blue;"&gt;="./FluentMigratorProof.dll"&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;     &lt;span style="color: red;"&gt;task&lt;/span&gt;&lt;span style="color: blue;"&gt;="rollback:all"&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;     &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;   &lt;span style="color: blue;"&gt;&lt;span style="color: maroon;"&gt;target&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;   &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;target&lt;/span&gt; &lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="migrate-Production"&lt;/span&gt; &lt;span style="color: red;"&gt;description&lt;/span&gt;&lt;span style="color: blue;"&gt;="Migrate the database to the latest version"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;     &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;migrate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;     &lt;span style="color: red;"&gt;database&lt;/span&gt;&lt;span style="color: blue;"&gt;="sql"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;     &lt;span style="color: red;"&gt;connection&lt;/span&gt;&lt;span style="color: blue;"&gt;="Data Source=Production\SQLEXPRESS;Initial Catalog=FluentMigratorProof;User Id=BuildUser;Password=xxxxxxx;"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;     &lt;span style="color: red;"&gt;namespace&lt;/span&gt;&lt;span style="color: blue;"&gt;="FluentMigratorProof"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt;     &lt;span style="color: red;"&gt;target&lt;/span&gt;&lt;span style="color: blue;"&gt;="./FluentMigratorProof.dll"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt;     &lt;span style="color: red;"&gt;profile&lt;/span&gt;&lt;span style="color: blue;"&gt;="Production"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum20" style="color: #606060;"&gt;  20:&lt;/span&gt;     &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum21" style="color: #606060;"&gt;  21:&lt;/span&gt;   &lt;span style="color: blue;"&gt;&lt;span style="color: maroon;"&gt;target&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum22" style="color: #606060;"&gt;  22:&lt;/span&gt;   &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;target&lt;/span&gt; &lt;span style="color: red;"&gt;name&lt;/span&gt;&lt;span style="color: blue;"&gt;="migrate-Development"&lt;/span&gt; &lt;span style="color: red;"&gt;description&lt;/span&gt;&lt;span style="color: blue;"&gt;="Migrate the database to the latest version"&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum23" style="color: #606060;"&gt;  23:&lt;/span&gt;     &lt;span style="color: blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon;"&gt;migrate&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum24" style="color: #606060;"&gt;  24:&lt;/span&gt;     &lt;span style="color: red;"&gt;database&lt;/span&gt;&lt;span style="color: blue;"&gt;="sql"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum25" style="color: #606060;"&gt;  25:&lt;/span&gt;     &lt;span style="color: red;"&gt;connection&lt;/span&gt;&lt;span style="color: blue;"&gt;="Data Source=DevBOX\SQLEXPRESS;Initial Catalog=FluentMigratorProof;User Id=BuildUser;Password=xxxxxx;"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum26" style="color: #606060;"&gt;  26:&lt;/span&gt;     &lt;span style="color: red;"&gt;namespace&lt;/span&gt;&lt;span style="color: blue;"&gt;="FluentMigratorProof"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum27" style="color: #606060;"&gt;  27:&lt;/span&gt;     &lt;span style="color: red;"&gt;target&lt;/span&gt;&lt;span style="color: blue;"&gt;="./FluentMigratorProof"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum28" style="color: #606060;"&gt;  28:&lt;/span&gt;     &lt;span style="color: red;"&gt;profile&lt;/span&gt;&lt;span style="color: blue;"&gt;="Development"&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum29" style="color: #606060;"&gt;  29:&lt;/span&gt;     &lt;span style="color: blue;"&gt;/&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum30" style="color: #606060;"&gt;  30:&lt;/span&gt;   &lt;span style="color: blue;"&gt;&lt;span style="color: maroon;"&gt;target&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum31" style="color: #606060;"&gt;  31:&lt;/span&gt; &lt;span style="color: blue;"&gt;&lt;span style="color: maroon;"&gt;project&lt;/span&gt;&lt;span style="color: blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;To use FluentMigrator with nAnt you use loadtask to specify the FluentMigrator.dll then you add a migrate task in your target.&amp;nbsp; Your migrate task will need to have the following properties:&lt;/div&gt;&lt;ul style="color: black;"&gt;&lt;li&gt;database – this specifies the type of DB (sql, oracle, sqllight, mysql, etc.) &lt;/li&gt;
&lt;li&gt;connection – this specifies the DataBase your going to connect to and with what permissions &lt;/li&gt;
&lt;li&gt;namespace – this is the application namespace your going to run allowing you to migrate multiple DB in the same project &lt;/li&gt;
&lt;li&gt;target – this is the .Dll you’re calling to migrate from &lt;/li&gt;
&lt;li&gt;Profile – this is what profile your loading &lt;/li&gt;
&lt;li&gt;task(optional) – this is how you specify what version you want to build, or if you want to roll back, etc. &lt;/li&gt;
&lt;/ul&gt;&lt;div style="color: black;"&gt;Then to run your migration simply run NAnt.exe with the name of your build file something like:&lt;/div&gt;&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span style="color: blue;"&gt;&lt;span style="color: blue;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; NAnt.exe -buildfile:ProofBuild.nant.build&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;div style="color: black;"&gt;A full explanation of using nAnt is a little out of scope for this blog post so if you want more info on nAnt see &lt;a href="http://nant.sourceforge.net/release/latest/help/" target="_blank"&gt;nAnt Help Page&lt;/a&gt;.&lt;/div&gt;&lt;div style="color: black;"&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div style="color: black;"&gt;As always here is a &lt;a href="http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/FluentMigratorProof/" target="_blank"&gt;sample project&lt;/a&gt; using this.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-4742290714164384075?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/Jh2kLYDR-cqzangL7i56K4JePyk/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Jh2kLYDR-cqzangL7i56K4JePyk/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/Jh2kLYDR-cqzangL7i56K4JePyk/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/Jh2kLYDR-cqzangL7i56K4JePyk/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/N6ev22iWR9A" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/N6ev22iWR9A/using-fluentmigrator-with-nant.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>1</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2011/07/using-fluentmigrator-with-nant.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-4743656165214573031</guid><pubDate>Thu, 14 Jul 2011 06:03:00 +0000</pubDate><atom:updated>2011-07-14T00:03:53.176-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Development</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Blogging</category><title>Where is the passion?</title><description>On the 4th of&amp;nbsp;July&amp;nbsp;I had a really good conversation with @jamis a former member of the rails core team and a fairly prominent member of the ruby&amp;nbsp;community&amp;nbsp;and I was reminded how much the Ruby community appers to be more dedicated to craftmanship then the .net community as a whole.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
This may be just an outsiders view but ruby devs seem to be more dedicated to pair programing,&amp;nbsp; TDD, CI, etc.&amp;nbsp; and basicly more interested in&amp;nbsp;writing&amp;nbsp;software to make a living vs. where in the dot net comunity it feels &amp;nbsp;more like developers write software just to make a living, there are a few leaders that&amp;nbsp; that push these ideas, but for the most part it seem more previlant in the ruby community.&lt;br /&gt;
&lt;br /&gt;
So my real question is, why?&amp;nbsp; is the ruby stack just more attractive to people of this disposion?&amp;nbsp; is it just becouse dot net is just more widely used and thus just has a wider spectrum of developers in it? &amp;nbsp;Is it just becouse I have a very limmited view of the ruby community and only seeing the cream of the crop, or am I just somewhat jaded and only seeing the negative in the .net community?&amp;nbsp; To this I don't have a good&amp;nbsp;answer.&lt;br /&gt;
&amp;nbsp;  &lt;br /&gt;
So the next question is how do we get the passion in the .NET dev stack?&amp;nbsp; it's not like there is a lack of interesting things to learn and build, can we do more community work?&amp;nbsp; Boise has a .NET user group (netdug), a software developers group(bsdg) that is mostly .net developers, and a code camp every year, but for the most part it's the same people group presenting.&amp;nbsp; my open question to the group is how do we get more&amp;nbsp;people&amp;nbsp;interested in presenting, do we start younger? maybe start youth dev groups? maybe as a group pressure each other to be more active?&amp;nbsp; For my part, I need to step up and do my part, and rededicate myself to blogging.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-4743656165214573031?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/iVOaIkElTNuu0PYjyur82MInjHE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iVOaIkElTNuu0PYjyur82MInjHE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/iVOaIkElTNuu0PYjyur82MInjHE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/iVOaIkElTNuu0PYjyur82MInjHE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/hsKslXLBPCw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/hsKslXLBPCw/where-is-passion.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2011/07/where-is-passion.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-6491478309939917744</guid><pubDate>Mon, 23 May 2011 14:02:00 +0000</pubDate><atom:updated>2011-05-23T08:02:52.245-06:00</atom:updated><title>Decoupling to Destruction</title><description>&lt;p&gt;One of the core concepts of well architected code is being decoupled, but like so many of the good things in life if you do it to much it becomes bad for you.&lt;/p&gt;  &lt;p&gt;Recently I worked on a piece if legacy code that from the UI to the Dal it passed an object though 7 classes and was converted from one object to the next 5 times.&amp;#160;&amp;#160; Their wasn’t any real difference from one object to the next.&amp;#160; In some cases it was pulled from the data object and each item was passed as a parameter into a method where it was then put into a new object.&amp;#160; The result was next to imposable to debug, even harder to read, and in a lot of places just plain sloppy.&amp;#160; &lt;/p&gt;  &lt;p&gt;In an earlier post &lt;a href="http://bob-the-janitor.blogspot.com/2009/07/n-tier-design-revisit-part-2-data.html" target="_blank"&gt;N-Tier Design Revisit part 2 – Data Entities&lt;/a&gt;&amp;#160; I talked about how data entities, poco, or dto (they are all basically the same thing more or less) work, they go from the UI though the Biz and to the Dal and back again.&amp;#160; This creates a message that is passed, your code is still decoupled because the Data Entity basally contains no logic, it’s just holding data.&amp;#160; &lt;/p&gt;  &lt;p&gt;Wring an application is kind of like growing a garden, if you take care of it and maintain it, it stays nice and easy to maintain.&amp;#160; If you neglect it it becomes difficult to maintain and will over time die.&amp;#160; Decoupling is one of the things you do to make it easy to maintain your application, kind of like watering it, and just like watering it if you do it to much you’ll kill it.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-6491478309939917744?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/tIyVmIKMlgNJyQU3TKmaPMqZkDE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tIyVmIKMlgNJyQU3TKmaPMqZkDE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/tIyVmIKMlgNJyQU3TKmaPMqZkDE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/tIyVmIKMlgNJyQU3TKmaPMqZkDE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/4pXkqYVkmF0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/4pXkqYVkmF0/decoupling-to-destruction.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2011/05/decoupling-to-destruction.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-6666087731786839603</guid><pubDate>Thu, 02 Dec 2010 08:26:00 +0000</pubDate><atom:updated>2010-12-02T01:35:11.488-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">MVC</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Jquery</category><title>Easy Ajax with ASP.NET MVC and Jquery</title><description>One of the reasons I love Asp.net MVC and Jquery is it makes client side coding so easy.&amp;nbsp; Here is a good example.&amp;nbsp; Lets say I want to have a html select control that updates automatically when it’s changed&lt;br /&gt;
First we build a Controller that has an action to output our view and an action to accept posts&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; [HandleError]&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; HomeController : Controller&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; ActionResult Index()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;         UserModel userModel = &lt;span style="color: blue;"&gt;new&lt;/span&gt; UserModel(){UserId = 1,Type = UserTypes.User};&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;         &lt;span style="color: blue;"&gt;return&lt;/span&gt; View(userModel);&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;     [AcceptVerbs(WebRequestMethods.Http.Post)]&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; ActionResult UpdateUserType(UpdateUser input)&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;         var result = &lt;span style="color: blue;"&gt;new&lt;/span&gt; {Succss = &lt;span style="color: blue;"&gt;true&lt;/span&gt;, Message = &lt;span style="color: #006080;"&gt;"Updated"&lt;/span&gt;};&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;         &lt;span style="color: blue;"&gt;return&lt;/span&gt; Json(result);&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;    }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;notice UpdateUserType() has the attribute “[AcceptVerbs(WebRequestMethods.Http.Post)]” this forces it to only allows posts, also it takes a complex type, in this case a class of type UpdateUser.&lt;br /&gt;
Here is a quick over view of the model objects we are going to be using&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 200px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; UserModel&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; UserId { get; set; }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; UserTypes Type { get; set; }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;enum&lt;/span&gt; UserTypes&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;     User = 1,&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;     PowerUser = 2,&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;     Admin = 3&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; UpdateUser&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;int&lt;/span&gt; UserId { get; set; }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; UserTypes Type { get; set; }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;one of the nice this is that MVC takes care of the mapping and casting for us as you’ll see in a second.&lt;br /&gt;
The view is a very simple and strongly typed for the UserModel, first build the select control&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom-color: silver; border-bottom-style: solid; border-bottom-width: 1px; border-left-color: silver; border-left-style: solid; border-left-width: 1px; border-right-color: silver; border-right-style: solid; border-right-width: 1px; border-top-color: silver; border-top-style: solid; border-top-width: 1px; cursor: text; direction: ltr; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 20px; max-height: 200px; overflow-x: auto; overflow-y: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow-x: visible; overflow-y: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &amp;lt;select name=&lt;span style="color: #006080;"&gt;"SelectUserType"&lt;/span&gt; onchange=&lt;span style="color: #006080;"&gt;"UpdateUserType(this,&amp;lt;%=Model.UserId%&amp;gt;)"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt;     &amp;lt;%&lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (UserTypes item &lt;span style="color: blue;"&gt;in&lt;/span&gt; Enum.GetValues(&lt;span style="color: blue;"&gt;typeof&lt;/span&gt;(UserTypes)).Cast&amp;lt;UserTypes&amp;gt;())&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;             &lt;span style="color: blue;"&gt;if&lt;/span&gt;(item ==  Model.Type)&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;                 %&amp;gt;&amp;lt;option selected=&lt;span style="color: #006080;"&gt;"selected"&lt;/span&gt; &lt;span style="color: blue;"&gt;value&lt;/span&gt;=&lt;span style="color: #006080;"&gt;"&amp;lt;%=((int)item).ToString() %&amp;gt;"&lt;/span&gt;&amp;gt;&amp;lt;%=item.ToString() %&amp;gt;&amp;lt;/option&amp;gt;&amp;lt;%&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;             &lt;span style="color: blue;"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;                 %&amp;gt;&amp;lt;option &lt;span style="color: blue;"&gt;value&lt;/span&gt;=&lt;span style="color: #006080;"&gt;"&amp;lt;%=((int)item).ToString() %&amp;gt;"&lt;/span&gt;&amp;gt;&amp;lt;%=item.ToString() %&amp;gt;&amp;lt;/option&amp;gt;&amp;lt;%&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;     } %&amp;gt;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt; &amp;lt;/select&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;this loops through the UserTypes Enum to populate the select control and selects the value that’s selected in the view Model and we add an onchange that points to a javascript function that we pass the control and the UserId from the model into.&lt;br /&gt;
Next we add the javascript function(fyi this requires Jquery)&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &amp;lt;script type=&lt;span style="color: #006080;"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt;     &lt;span style="color: blue;"&gt;function&lt;/span&gt; UpdateUserType(sender, userId) {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;         &lt;span style="color: blue;"&gt;var&lt;/span&gt; model = { UserId: userId, Type: sender.value };&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;         $.post(&lt;span style="color: #006080;"&gt;"/home/UpdateUserType"&lt;/span&gt;,&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;             model,&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;            &lt;span style="color: blue;"&gt;function&lt;/span&gt; (data) {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;                alert(&lt;span style="color: #006080;"&gt;"Was Successful: "&lt;/span&gt; + data.Succss);&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;                alert(&lt;span style="color: #006080;"&gt;"Message: "&lt;/span&gt; + data.Message);&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;            });&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt; &amp;lt;/script&amp;gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;First we build a JSON object where the property names need to match the properly names in UpdateUser, Asp.net MVC needs this for mapping, and then we use Jquery $.post passing in the action URL, the JSON object we just built, and a javascript function to handle the returned data and your done.&lt;br /&gt;
&lt;br /&gt;
A quick and easy way to add Ajax to any control and as always here is a link to the demo project &lt;a href="http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/ajaxMadeEasy/"&gt;http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/ajaxMadeEasy/&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-6666087731786839603?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/0GiU_EDyztuC8cj8T6lZT8XTRRw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0GiU_EDyztuC8cj8T6lZT8XTRRw/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/0GiU_EDyztuC8cj8T6lZT8XTRRw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/0GiU_EDyztuC8cj8T6lZT8XTRRw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/-wisyckWuX4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/-wisyckWuX4/easy-ajax-with-aspnet-mvc-and-jquery.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/12/easy-ajax-with-aspnet-mvc-and-jquery.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-9214726447231854068</guid><pubDate>Thu, 22 Jul 2010 08:23:00 +0000</pubDate><atom:updated>2010-07-22T02:27:41.945-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Design Patterns</category><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">Teamwork</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>The evil of process over craftsmanship</title><description>If you had a choice between a well build home that cost more money but wasn’t going to cost very much to maintain or a house that didn’t cost very much, but was going to cost a lot more to maintain in the long run, which would you choose.&amp;nbsp; If you own a house and have had to deal with the upkeep of the home I can almost guarantee you would much rather have the first house, even if fixing the major problems is free (most new houses come with a one year guarantee from the builder), if you have ever had to deal with getting your builder to fixed things, free or not, the stress and aggravation almost makes it not worth it.&amp;nbsp; So why do so many software development teams almost insist on building software like second house was built.&lt;br /&gt;
&lt;br /&gt;
By taking the time to build a quality product, it will cost more up front, talented people cost money, to do the job right takes time(time=money) but because it was done right the first time it costs a lot less in the long run.&amp;nbsp; &lt;br /&gt;
Unfortunately in the software development world it’s far to common to just get it out and worry about fixing known problems later.&amp;nbsp; This becomes even more painful when the schedule or process becomes the reason for poor craftsmanship.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Here are two problems, one is building a house the other is building software:&lt;br /&gt;
&lt;br /&gt;
1) A builder starts working on a house and discovers that the property has a high water table and that every spring there would be flooding in the crawlspace.&amp;nbsp; The two ways to solve this problem are: bring in enough dirt to raise the house up so the crawlspace doesn't get flooded or add subpumps to pump the water out.&amp;nbsp; Both fix the problem, while the subpumps are going to be quicker to setup, it’s not going to get out all of the water and it will add to maintenance costs which in the long run will be much more expensive.&lt;br /&gt;
&lt;br /&gt;
2) A pair of developers are tasked with writing a service for importing data into a database and half way though writing it they find out the data has duplicate records and some other garbage data.&amp;nbsp; There are two ways to solve this, build a validator to remove the garbage data or pass it off and have the DBAs create a job to remove the garbage from the database.&lt;br /&gt;
&lt;br /&gt;
I’m fairly sure we would all much rather take the time to put in the fill dirt then have to deal with the maintenance of having sub pumps, and yet for some reason it’s very common for developers to be told “we don’t have time to add a filter” and to push the task of removing the garbage from the database onto the DBAs, or worse yet just live with the garbage data.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
We know that when the process(schedule/tasking) trumps craftsmanship(using subpumps or having the DBAs remove bad data) you end up with a lower quality product with higher overall costs so why do we still do it?&lt;br /&gt;
The tools of the software craftsman: TDD, design patterns(command, strategy, observer, etc ), decoupled design, source control, continues integration, paired programming, etc.&amp;nbsp; and by using any of them you will end up with better software with lower overall costs and yet it feels like it’s a constant battle to get them into our development process.&amp;nbsp; We need to take a stand, we need to be craftsman and insist on building quality products.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-9214726447231854068?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hZtUxV9gxP0b1UWKuoMX3Jw0WaA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hZtUxV9gxP0b1UWKuoMX3Jw0WaA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/hZtUxV9gxP0b1UWKuoMX3Jw0WaA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hZtUxV9gxP0b1UWKuoMX3Jw0WaA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/raOpn6qFbYQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/raOpn6qFbYQ/evil-of-process-over-craftsmanship.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/07/evil-of-process-over-craftsmanship.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-7173327089378976091</guid><pubDate>Fri, 28 May 2010 13:23:00 +0000</pubDate><atom:updated>2010-05-28T07:24:25.018-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Development</category><category domain="http://www.blogger.com/atom/ns#">Design Patterns</category><title>Using the Observer Pattern</title><description>At work we are reading “Head First Design Patterns” and discussing the “Observer Pattern” and some people wanted to see a code example.&lt;br /&gt;
The first part is the the class that manages the observer classes &lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; EventManager&amp;lt;T&amp;gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; { &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     &lt;span style="color: blue;"&gt;private&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;, ISubscriber&amp;lt;T&amp;gt;&amp;gt; _subscribers = &lt;span style="color: blue;"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;, ISubscriber&amp;lt;T&amp;gt;&amp;gt;();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;,ISubscriber&amp;lt;T&amp;gt;&amp;gt; Subscribers&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;         get { &lt;span style="color: blue;"&gt;return&lt;/span&gt; _subscribers; }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;         set { _subscribers = &lt;span style="color: blue;"&gt;value&lt;/span&gt;; }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Notify(T newState)&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;         &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (var observer &lt;span style="color: blue;"&gt;in&lt;/span&gt; Subscribers.Values)&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;             observer.State = newState;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;             observer.Update();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;In this example I created a generic class that has two basic parts a collection of subscribers or observers and a method that loops though and updates the state of the subscribers.&amp;nbsp; I used a Dictionary&amp;lt;string,ISubscriber&amp;lt;T&amp;gt;&amp;gt; to make it easy to manage my subscribers based on a key, and because ISubscriber&amp;lt;T&amp;gt; is also a generic its a very flexible and strongly typed way to work with the subscribers.&lt;br /&gt;
&lt;br /&gt;
Next let’s take a look at ISubscriber&amp;lt;T&amp;gt; interface&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;interface&lt;/span&gt; ISubscriber&amp;lt;T&amp;gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     T State { get; set; }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     &lt;span style="color: blue;"&gt;void&lt;/span&gt; Update();&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;it’s that simple, I use generics to determine the state and the input type for the update method, here is an example implementation&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; TweetLocation : ISubscriber&amp;lt;Location&amp;gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; ITwitter TwitterInterfacer = &lt;span style="color: blue;"&gt;new&lt;/span&gt; FakeTwitterClient();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; Location State { get; set; }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Update()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;         TwitterInterfacer.TweetMessage(&lt;span style="color: blue;"&gt;string&lt;/span&gt;.Format(&lt;span style="color: #006080;"&gt;"currently at ({0},{1})"&lt;/span&gt;,State.Lat,State.Lon));&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;TweetLocation is observing Location information and calls a Twitter class to Tweet the new location when updated, for something a little more complex&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; SaveLocation : ISubscriber&amp;lt;Location&amp;gt;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; ILocationReposigtory LocationRepository = &lt;span style="color: blue;"&gt;new&lt;/span&gt; FakeLocationRepository();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; EventManager&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt; ErrorHandler = &lt;span style="color: blue;"&gt;new&lt;/span&gt; EventManager&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt;();&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; Location State{get;set;}&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; SaveLocation()&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;         ErrorHandler.Subscribers.Add(&lt;span style="color: #006080;"&gt;"ErrorMailer"&lt;/span&gt;,&lt;span style="color: blue;"&gt;new&lt;/span&gt; ErrorMailer());&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Update()&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;         &lt;span style="color: blue;"&gt;bool&lt;/span&gt; success = LocationRepository.SaveLocation(State);&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;         &lt;span style="color: blue;"&gt;if&lt;/span&gt; (!success)&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt;             ErrorHandler.Notify(&lt;span style="color: #006080;"&gt;"Failed to save location"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum20" style="color: #606060;"&gt;  20:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum21" style="color: #606060;"&gt;  21:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;SaveLocation is basically the same as TweetLocation except it has it’s own EventManager to handle errors from failed attempts at saving the location.&lt;br /&gt;
&lt;br /&gt;
Finally here is an example of actually using it&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border-bottom: silver 1px solid; border-left: silver 1px solid; border-right: silver 1px solid; border-top: silver 1px solid; cursor: text; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding-bottom: 4px; padding-left: 4px; padding-right: 4px; padding-top: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; Program&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; EventManager&amp;lt;Location&amp;gt; LocationHandler = &lt;span style="color: blue;"&gt;new&lt;/span&gt; EventManager&amp;lt;Location&amp;gt;();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt;     &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Main(&lt;span style="color: blue;"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt;         LocationHandler.Subscribers.Add(&lt;span style="color: #006080;"&gt;"Repository"&lt;/span&gt;,&lt;span style="color: blue;"&gt;new&lt;/span&gt; SaveLocation());&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;         LocationHandler.Subscribers.Add(&lt;span style="color: #006080;"&gt;"Twitter"&lt;/span&gt;,&lt;span style="color: blue;"&gt;new&lt;/span&gt; TweetLocation());&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;         Location currentLocation = &lt;span style="color: blue;"&gt;new&lt;/span&gt; Location(){Lat = 111,Lon = -121};&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;         LocationHandler.Notify(currentLocation);&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;         Console.ReadKey();&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;         currentLocation.Lon = 1211;&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;         LocationHandler.Subscribers.Remove(&lt;span style="color: #006080;"&gt;"Twitter"&lt;/span&gt;);&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt;         LocationHandler.Notify(currentLocation);&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum20" style="color: #606060;"&gt;  20:&lt;/span&gt;         Console.ReadKey();&lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum21" style="color: #606060;"&gt;  21:&lt;/span&gt;         &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum22" style="color: #606060;"&gt;  22:&lt;/span&gt;         &lt;/pre&gt;&lt;pre style="background-color: white; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum23" style="color: #606060;"&gt;  23:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-bottom-style: none; border-left-style: none; border-right-style: none; border-top-style: none; color: black; direction: ltr; font-family: 'Courier New', courier, monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum24" style="color: #606060;"&gt;  24:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;This is a simple console app that demonstrates adding subscribers, updating state, and removing a subscriber.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
A real world example of using “Observer Pattern” is a service bus like &lt;a href="http://www.nservicebus.com/" target="_blank"&gt;NServiceBus&lt;/a&gt; or &lt;a href="http://code.google.com/p/masstransit/" target="_blank"&gt;MassTransit&lt;/a&gt;, where an event driven application needs to send messages to one or more subscribers.&lt;br /&gt;
&lt;br /&gt;
As always here is a link to the &lt;a href="http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/ObserverDemo/" target="_blank"&gt;project source&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-7173327089378976091?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/XMjYl5JU3tWuQp80RGwZS4iLRBM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XMjYl5JU3tWuQp80RGwZS4iLRBM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/XMjYl5JU3tWuQp80RGwZS4iLRBM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/XMjYl5JU3tWuQp80RGwZS4iLRBM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/d_zn9zt-MXw" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/d_zn9zt-MXw/using-observer-pattern.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/05/using-observer-pattern.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-3183273231372858550</guid><pubDate>Wed, 12 May 2010 06:05:00 +0000</pubDate><atom:updated>2010-05-12T00:11:08.759-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Amazon Web Services</category><category domain="http://www.blogger.com/atom/ns#">Cloud Computing</category><title>Another walk in the cloud with Amazon Web Services</title><description>Talking a look at some of the offering that Amazon Cloud Services has I decided to take a look at Amazon Simple Storage Service or simply Amazon S3.&amp;nbsp;&lt;br /&gt;
&lt;br /&gt;
Like I wrote in “&lt;a href="http://bob-the-janitor.blogspot.com/2009/10/walk-in-clouds-with-simpledb.html" target="_blank"&gt;A walk in the Cloud&lt;/a&gt;” the Amazon cloud can be accessed though a web service so you have the option of rolling your own tools or using their API lib.&amp;nbsp; The has SDK has defiantly improved and the install process is a lot easier now.&amp;nbsp; Before you had to download the source, build the project, etc, now all you have to do is download &lt;a href="http://aws.amazon.com/sdkfornet/" target="_blank"&gt;AWSSDKForNET&lt;/a&gt; and install it.&amp;nbsp; This adds the Clint to your GAC, and add templates into Visual Studio, if you still want to see what they are doing under the hood you can still download the source.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
Amazon may not provide you with any tools but there are a few free ones that work fairly well.&amp;nbsp; &lt;a href="http://www.cloudberrylab.com/default.aspx?page=cloudberry-explorer-amazon-s3" target="_blank"&gt;CloudBerry Explorer&lt;/a&gt; is a fairly solid tool for managing your S3 storage, it looks kind of like an ftp client and it lets you manage multiple accounts, create buckets, upload/download content, generate web URLs(http and https), search, etc. Another client is the Firefox plug-in &lt;a href="http://www.s3fox.net/Features.aspx?isnew=true&amp;amp;from=addon" target="_blank"&gt;S3Fox&lt;/a&gt;, basically the same as CloudBerry but it runs in Firefox.&lt;br /&gt;
&lt;br /&gt;
Pulling data from S3 is relatively simple, this is a code sample for pulling your list of buckets, then building a list of links to the images in each bucket&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border: 1px solid silver; cursor: text; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; AmazonS3 s3Client = AWSClientFactory.CreateAmazonS3Client(&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt;     ConfigurationManager.AppSettings[&lt;span style="color: #006080;"&gt;"AWSAccessKey"&lt;/span&gt;],&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;     ConfigurationManager.AppSettings[&lt;span style="color: #006080;"&gt;"AWSSecretKey"&lt;/span&gt;]);&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt; ListBucketsResponse response = s3Client.ListBuckets();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;    &lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt; &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (S3Bucket bucket &lt;span style="color: blue;"&gt;in&lt;/span&gt; response.Buckets)&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;     HtmlGenericControl header = &lt;span style="color: blue;"&gt;new&lt;/span&gt; HtmlGenericControl(&lt;span style="color: #006080;"&gt;"div"&lt;/span&gt;)&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;         InnerText = bucket.BucketName&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;     };&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;     DivlistOfImages.Controls.Add(header);&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;     ListObjectsRequest request = &lt;span style="color: blue;"&gt;new&lt;/span&gt; ListObjectsRequest&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;      {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt;          BucketName = bucket.BucketName&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt;      };&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum20" style="color: #606060;"&gt;  20:&lt;/span&gt;     ListObjectsResponse imageList = s3Client.ListObjects(request);&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum21" style="color: #606060;"&gt;  21:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum22" style="color: #606060;"&gt;  22:&lt;/span&gt;     &lt;span style="color: blue;"&gt;foreach&lt;/span&gt; (S3Object s3Object &lt;span style="color: blue;"&gt;in&lt;/span&gt; imageList.S3Objects)&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum23" style="color: #606060;"&gt;  23:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum24" style="color: #606060;"&gt;  24:&lt;/span&gt;         HtmlAnchor imageLink = &lt;span style="color: blue;"&gt;new&lt;/span&gt; HtmlAnchor&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum25" style="color: #606060;"&gt;  25:&lt;/span&gt;        {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum26" style="color: #606060;"&gt;  26:&lt;/span&gt;            InnerText = s3Object.Key&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum27" style="color: #606060;"&gt;  27:&lt;/span&gt;        };&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum28" style="color: #606060;"&gt;  28:&lt;/span&gt;         &lt;span style="color: blue;"&gt;string&lt;/span&gt; bucketName = bucket.BucketName;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum29" style="color: #606060;"&gt;  29:&lt;/span&gt;         &lt;span style="color: blue;"&gt;string&lt;/span&gt; objectKey = s3Object.Key;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum30" style="color: #606060;"&gt;  30:&lt;/span&gt;         GetPreSignedUrlRequest preSignedUrlRequest = &lt;span style="color: blue;"&gt;new&lt;/span&gt; GetPreSignedUrlRequest&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum31" style="color: #606060;"&gt;  31:&lt;/span&gt;          {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum32" style="color: #606060;"&gt;  32:&lt;/span&gt;              BucketName = bucketName,&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum33" style="color: #606060;"&gt;  33:&lt;/span&gt;              Key = objectKey,&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum34" style="color: #606060;"&gt;  34:&lt;/span&gt;              Protocol = Protocol.HTTP,&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum35" style="color: #606060;"&gt;  35:&lt;/span&gt;              Expires = DateTime.Now.AddDays(7)&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum36" style="color: #606060;"&gt;  36:&lt;/span&gt;          };&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum37" style="color: #606060;"&gt;  37:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum38" style="color: #606060;"&gt;  38:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum39" style="color: #606060;"&gt;  39:&lt;/span&gt;         imageLink.HRef = s3Client.GetPreSignedURL(preSignedUrlRequest);&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum40" style="color: #606060;"&gt;  40:&lt;/span&gt;         DivlistOfImages.Controls.Add(imageLink);&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum41" style="color: #606060;"&gt;  41:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum42" style="color: #606060;"&gt;  42:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;it’s that simple. &lt;br /&gt;
&lt;br /&gt;
With this you can have your content be managed by another department with a tool like CloudBerry and remove the work of updating images and other forms of content.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
As always here is a link to the &lt;a href="http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/S3Proof/" target="_blank"&gt;sample code project&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-3183273231372858550?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dxPQO7e7Lq3HXcxd8IxHcFxA4u4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dxPQO7e7Lq3HXcxd8IxHcFxA4u4/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/dxPQO7e7Lq3HXcxd8IxHcFxA4u4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dxPQO7e7Lq3HXcxd8IxHcFxA4u4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/y8KF3LvhFjg" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/y8KF3LvhFjg/another-walk-in-cloud-with-amazon-web.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>1</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/05/another-walk-in-cloud-with-amazon-web.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-8031360484071121728</guid><pubDate>Fri, 16 Apr 2010 03:10:00 +0000</pubDate><atom:updated>2010-04-15T21:18:01.493-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Mocking</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Telerik</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Taking Telerik’s Just Mock for a test drive</title><description>Telerik has released a beta of JustMock (a mocking framework) they claim can easily mock anything including sealed classes, non-virtual methods, and static classes.&amp;nbsp; If they can do this great!, but lets see just how well this actually works by taking a look at some of the biggest pains to test: HttpContext and SqlConnection.&lt;br /&gt;
&lt;h3&gt;&amp;nbsp;&lt;/h3&gt;&lt;h3&gt;HttpContext Test&lt;/h3&gt;Test: Can I mock HttpContext, set a value, and get the value, in this case Error&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border: 1px solid silver; cursor: text; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; ErrorLoger target;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; TestError = &lt;span style="color: #006080;"&gt;"Test Error"&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; MockILogger MockLogger;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt; [SetUp]&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Setup()&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;     target = &lt;span style="color: blue;"&gt;new&lt;/span&gt; ErrorLoger();&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt;     HttpContext mockContext = Mock.Create&amp;lt;HttpContext&amp;gt;();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt;     Mock.Arrange(() =&amp;gt; mockContext.Error).Returns(&lt;span style="color: blue;"&gt;new&lt;/span&gt; Exception(TestError));&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt;     target.Context = mockContext;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;     MockLogger = &lt;span style="color: blue;"&gt;new&lt;/span&gt; MockILogger();&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;     target.LoggerInterface = MockLogger;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;        &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt; [Test]    &lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; LogError_SetsLoggerMessageEqualToContextErrorMessage_Test()&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt;    target.LogError();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum20" style="color: #606060;"&gt;  20:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum21" style="color: #606060;"&gt;  21:&lt;/span&gt;    Assert.AreEqual(TestError,MockLogger.Message);&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum22" style="color: #606060;"&gt;  22:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
&lt;br /&gt;
Result: Just Mock crashes when it tries to mock HttpContext.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;SqlConnection Test&lt;/h3&gt;Test: Can I mock a SqlConnection and open a connection with out really opening a connection.&lt;br /&gt;
&lt;div id="codeSnippetWrapper" style="background-color: #f4f4f4; border: 1px solid silver; cursor: text; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 20px 0px 10px; max-height: 200px; overflow: auto; padding: 4px; text-align: left; width: 97.5%;"&gt;&lt;div id="codeSnippet" style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum1" style="color: #606060;"&gt;   1:&lt;/span&gt; &lt;span style="color: blue;"&gt;private&lt;/span&gt; DataRequest target;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum2" style="color: #606060;"&gt;   2:&lt;/span&gt; &lt;span style="color: blue;"&gt;private&lt;/span&gt; &lt;span style="color: blue;"&gt;bool&lt;/span&gt; SqlConnectionOpened;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum3" style="color: #606060;"&gt;   3:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum4" style="color: #606060;"&gt;   4:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; SqlConnectionOpenedCalled()&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum5" style="color: #606060;"&gt;   5:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum6" style="color: #606060;"&gt;   6:&lt;/span&gt;     SqlConnectionOpened = &lt;span style="color: blue;"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum7" style="color: #606060;"&gt;   7:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum8" style="color: #606060;"&gt;   8:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum9" style="color: #606060;"&gt;   9:&lt;/span&gt; [SetUp]&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum10" style="color: #606060;"&gt;  10:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Setup()&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum11" style="color: #606060;"&gt;  11:&lt;/span&gt; {&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum12" style="color: #606060;"&gt;  12:&lt;/span&gt;     SqlConnectionOpened = &lt;span style="color: blue;"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum13" style="color: #606060;"&gt;  13:&lt;/span&gt;     target = &lt;span style="color: blue;"&gt;new&lt;/span&gt; DataRequest();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum14" style="color: #606060;"&gt;  14:&lt;/span&gt;     &lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum15" style="color: #606060;"&gt;  15:&lt;/span&gt;     var mockSqlConnection = Mock.Create&amp;lt;SqlConnection&amp;gt;();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum16" style="color: #606060;"&gt;  16:&lt;/span&gt;     Mock.Arrange(() =&amp;gt; mockSqlConnection.Open()).DoInstead(SqlConnectionOpenedCalled);&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum17" style="color: #606060;"&gt;  17:&lt;/span&gt;     target.Connection = mockSqlConnection;&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum18" style="color: #606060;"&gt;  18:&lt;/span&gt; }&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum19" style="color: #606060;"&gt;  19:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum20" style="color: #606060;"&gt;  20:&lt;/span&gt; [Test]&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum21" style="color: #606060;"&gt;  21:&lt;/span&gt; &lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; GetUserList_Test()&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum22" style="color: #606060;"&gt;  22:&lt;/span&gt; {           &lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum23" style="color: #606060;"&gt;  23:&lt;/span&gt;     List&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt; actual = target.GetUserList();&lt;/pre&gt;&lt;pre style="background-color: #f4f4f4; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum24" style="color: #606060;"&gt;  24:&lt;/span&gt;     Assert.AreEqual(&lt;span style="color: blue;"&gt;true&lt;/span&gt;, SqlConnectionOpened);&lt;/pre&gt;&lt;pre style="background-color: white; border-style: none; color: black; direction: ltr; font-family: 'Courier New',courier,monospace; font-size: 8pt; line-height: 12pt; margin: 0em; overflow: visible; padding: 0px; text-align: left; width: 100%;"&gt;&lt;span id="lnum25" style="color: #606060;"&gt;  25:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;br /&gt;
Result: Just Mock was able to create the mock without crashing but when I try to set alternate functionality to the Open method, recording that I called Open, it crashes saying invalid connection string.&amp;nbsp; My question is why does it care about a connection string when I’m setting behavior, unless I’m missing how to set this up.&lt;br /&gt;
&lt;br /&gt;
&lt;h3&gt;Conclusion&lt;/h3&gt;As you can see in the examples the syntax is nice and simple, unfortunately Just Mock failed to pass either of my test and to be honest I’m not surprised, it’s in early beta and I tested it against the hardest problems I can think of to solve, something that none of the other mocking frameworks I have looked at even attempt.&amp;nbsp; &lt;br /&gt;
&lt;br /&gt;
What really impressed me was that while working on this I tweeted about having problems and within a couple of hours @hkosev (Hristo Kosev) from Telerik, who isn’t one of my followers, tweeted me asking what I was doing to get the errors and asked me if I would mind sending him the source for what I was doing so they could solve the problem, without even asking for help, very nice.&lt;br /&gt;
&lt;br /&gt;
As always here is the link to my &lt;a href="http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/" target="_blank"&gt;source code&lt;/a&gt;.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-8031360484071121728?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/KJISEyUzxh7YVjrUdKjL68P1Crs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KJISEyUzxh7YVjrUdKjL68P1Crs/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/KJISEyUzxh7YVjrUdKjL68P1Crs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/KJISEyUzxh7YVjrUdKjL68P1Crs/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/9O6npa2VIP4" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/9O6npa2VIP4/taking-teleriks-just-mock-for-test.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>1</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/04/taking-teleriks-just-mock-for-test.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-3913892314368641646</guid><pubDate>Mon, 05 Apr 2010 04:24:00 +0000</pubDate><atom:updated>2010-04-04T22:24:19.461-06:00</atom:updated><title>Using what works</title><description>&lt;p&gt;What’s with the hating, can’t we all just get along? The agile guys vs. non-agile, Windows vs. Mac vs. Linux/Unix, and we can’t forget the language wars.&amp;#160; So why do we get so entrenched in the belief that the way we do it is right and everyone else is wrong; call it ego, pride, or something else, it doesn't really matter, why do we do it.&amp;#160; By nature we are problem solvers so why do we have such a hard time accepting other’s ways/tools for solving problems?&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Agile vs. Non-agile&lt;/h3&gt;  &lt;p&gt;Having worked in both agile and non-agile environments, I have to say I like agile, I think if done right for most development environments it has a lot of advantages, the key here is if it’s done right, and for most environments.&amp;#160; If your daily scrum meeting are taking more then 30min, there is strong possibility your doing something wrong.&amp;#160; On the other side with a few exceptions, the idea of specifying every feature your project is going to have before anything is written is, well naive at best.&amp;#160; At the patterns and practices conference Billy Hollis make some comments that really upset a fair number of people in the agile community, and in return they responded with that Billy doesn't know what he’s talking about, etc.&amp;#160; To this my thought was your both right and at the same time wrong.&amp;#160; &lt;/p&gt;  &lt;p&gt;Agile doesn't work for everyone, some teams just can’t do it, and that’s ok, you shouldn’t feel bad because your not doing it the way the “cool kids” are, the important thing is to find a development methodology that works for your team.&amp;#160; Having said that, there are a lot of practices that have come out of the agile methodologies that can greatly benefit the non-agile groups, I don’t care what you say unit testing benefits everyone, having a build deploy server helps everyone, etc.&amp;#160; &lt;/p&gt;  &lt;p&gt;To the agile zealots out there, agile is A WAY to develop successful and maintainable&amp;#160; software, it’s not the only way.&amp;#160; Lots of very successful projects have been written with non-agile methodologies and lots of very unsuccessful projects have been written using agile.&amp;#160; Everything has it’s advantages and disadvantages, let’s face it the larger your team the harder agile gets.&amp;#160; As in most things zealotry is wrong, I don’t care how good the dogma is, it’s not more important then getting the job done, the most important thing is to get the job done, so find what works for you and do it.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h3&gt;Windows vs. Mac vs. Linux/Unix&lt;/h3&gt;  &lt;p&gt;The OS fan boy wars are a never ending battle between people who for the most part really just don’t get it. So let’s break down the fan boys:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Windows fan boys: For the most part they have never used anything but windows, everyone else uses windows so it must be the best at everything so it doesn't matter what Microsoft provides it’s the best. &lt;/li&gt;    &lt;li&gt;Mac fan boys: Their like the popular kids in school that you don’t understand why their popular because no one really like them that much, and then you add on a devotion that is almost like a cult with Steve Jobs as their messiah.&amp;#160; Some are disillusioned windows fan boys others where born into the Mac fold and all have a limited understanding of what’s out there. &lt;/li&gt;    &lt;li&gt;Linux/Unix fan boys:&amp;#160; Seeing themselves as elite or ultra power users they look down at windows and Mac users as lower life forms, yet at the same time they are constantly defending their OS.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I must make the disclaimer that I am a former Linux fan boy and to this day I see a lot of faults with windows, but on the flip side I see a lot of improvements that have been made in windows that make it a lot more attractive, but I still really like Linux, funny that I’m a .NET developer.&amp;#160; All three OS have their strengths and their weaknesses and all three work as a development platform, albeit some are better at some development stacks(.NET is easier on windows) and some development requires a specific OS(if you are doing IPhone development you need to have Mac), in all honestly all three work well and it really comes down to what the user likes out of their OS.&amp;#160; I have known some very talented graphic artists that don’t like Macs and have been very frustrated by having to use one, on the flip side I have a Ruby developer friend that really likes Macs. &lt;/p&gt;  &lt;p&gt;So in the end it really comes down to is how can we make what we have work for what we are doing, and choosing the right tool for the job, and for who is doing it verses following some techno dogma.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-3913892314368641646?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/vZrckdBT4JKBDxiovqba8_IGWGM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vZrckdBT4JKBDxiovqba8_IGWGM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/vZrckdBT4JKBDxiovqba8_IGWGM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/vZrckdBT4JKBDxiovqba8_IGWGM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/ewCBhwBtl-0" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/ewCBhwBtl-0/using-what-works.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/04/using-what-works.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-843166589014535566</guid><pubDate>Sun, 04 Apr 2010 22:45:00 +0000</pubDate><atom:updated>2010-04-04T16:45:34.629-06:00</atom:updated><title>Giving them what they need, verses what they ask for</title><description>&lt;p&gt;A little while ago I was contacted to see if I could help an elderly member of my congregation, she needed some help building a mail box post.&amp;#160; The phone call went something like this &lt;/p&gt;  &lt;p&gt;&lt;em&gt;her: Do you have a table saw?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;me: ya, what do you need?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;her: I need to cut up a 4x4 post&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;me: ok, what are you building?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;her: A mail box post and I need to cut some braces at 45 degree angle, you can do that with a table saw right?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;me: Bring your stuff over and I’ll help you build it.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;This is a perfect example of someone who knew what they needed, but not how to get it.&amp;#160; What she needed was some supports cut with 45 degree angles, and she knew that a table saw could make 45 degree angle cuts, and true a table was could do it, BUT it’s really not the right tool, you’re far better off using a miter saw.&lt;/p&gt;  &lt;p&gt;This got me thinking how often we as “tech” have been asked to do something only later to find out it’s really not what they needed or wanted.&amp;#160; &lt;/p&gt;  &lt;p&gt;a possible example:&lt;/p&gt;  &lt;p&gt;&lt;em&gt;marketing: we need a share point server.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;tech: sure, who needs access&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;marketing: The graphics designer&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;tech: you want a share point server for one person?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;marketing: yes&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;tech: what is she going to use it for?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;marketing: tracking the changes made to images&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;tech: you want a share point server to track image images revisions&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;marketing: yes, is there a problem with that?&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;&lt;em&gt;tech: Let me show you subversion.&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;This is a very good example of someone having a need and coming up with a solution without consulting with anyone, and asking for the solution without explaining the problem.&amp;#160; In this case I used a marketing person, but this could just as easily be a developer not consulting with operations, or a DBA not consulting with the developers.&amp;#160; &lt;/p&gt;  &lt;p&gt;Far to often we are asked to do things with little or not explanation to the problem we are providing a solution for and we don’t ask questions as to what we are solving and this really is a disservice to who we are helping. &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-843166589014535566?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/hfxk11B3a3uYa2VMj4elVbuM3d8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hfxk11B3a3uYa2VMj4elVbuM3d8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/hfxk11B3a3uYa2VMj4elVbuM3d8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/hfxk11B3a3uYa2VMj4elVbuM3d8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/NpRAlUJGXlk" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/NpRAlUJGXlk/giving-them-what-they-need-verses-what.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/04/giving-them-what-they-need-verses-what.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-1887318024370672404</guid><pubDate>Fri, 02 Apr 2010 14:08:00 +0000</pubDate><atom:updated>2010-04-02T13:17:46.555-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tools</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Visual Studio 2010</category><title>The VS2010 Preview</title><description>At the local VS2010 Even held in Boise, Id we where given a basic over view of what's in VS 2010, while some of these feature are innovate, like the testing tools, there was a lot of Microsoft playing catch up with some of the other IDEs out there.  This by no means is a complete list of what is in VS2010, this is just what was presented at the preview, with a little bit of my commentary added by me.&lt;br /&gt;
&lt;h4&gt;Team project collection&lt;/h4&gt;One of the new features is the Team project collection is TFS, while this sounds great, I fail to see where this is a big step up from other source control systems like clear case, subversion, etc. that have been doing this from the beginning, is this Microsoft playing catch up? or am I missing something.&lt;br /&gt;
&lt;h4&gt;Project templates&lt;/h4&gt;With so many more project types in VS2010 there are a lot more project templates, including Database projects, something to keep in mind is the DB projects only support SQL Server 2005+, sorry SQL Server 2000 people, an interesting side note, you can get a plug-in from Quest software for supporting Oracle.&lt;br /&gt;
&lt;h4&gt;Extension manager&lt;/h4&gt;One of the long awaited features for VS is the Extension Manager, as a user you can manage what extensions you have on your system and browse for new extensions in the online gallery.  While I really like this feature, lets face it, Microsoft was really late to the party with this, seeing that most other IDEs (Eclipse, Sharp Develop, Mono Develop, etc ) have been doing this for years.&lt;br /&gt;
&lt;h4&gt;Multi framework targeting&lt;/h4&gt;VS2010 now has multi framework support, now vs2008 did support .NET 2.0, 3.0, 3.5 but under the hood it's still the 2.0 CLR. &amp;nbsp;In VS2010 you can run code on the 2.0 and 4.0 CLR, this was something the Microsoft reps where very proud of. &amp;nbsp;Unfortunately this is another area where Microsoft was late to the party where a lot of the other IDEs have been supporting multiple frameworks for years and it get even more prevalent when you get outside the .NET stack.&lt;br /&gt;
&lt;h4&gt;IDE improvements&lt;/h4&gt;The IDE improvements in VS is one area where Microsoft is a leader.  Where VS2008 added refactoring tools VS2010 improved upon them, but you're still going to have to pull ReSharper out of my cold dead hand. A quick overview of the IDE improvements in VS2010&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;improved refactoring tools &lt;/li&gt;
&lt;li&gt;improved debug tools &lt;/li&gt;
&lt;li&gt;new IDE profiles (environment templates) &lt;/li&gt;
&lt;li&gt;improved MVC support &lt;/li&gt;
&lt;li&gt;performance monitoring &lt;/li&gt;
&lt;li&gt;Local deployment build with end to end packaging for web application &lt;/li&gt;
&lt;li&gt;improved SharePoint development integration &lt;/li&gt;
&lt;/ul&gt;&lt;h4&gt;.NET 4.0 CLR improvements&lt;/h4&gt;With VS2010 comes the 4.0 CLR, not only did they improve the performance of the framework they also made strides to make better use of multi core systems. &amp;nbsp;Lets face it multi threading in general is painful, to solve this .NET 4.0 has an improved threading pooling engine, they now fully support the functional language F# out of the box, and have full support plinq. &amp;nbsp;Plinq lets you spread the work of a linq Query across multiple cores by&amp;nbsp;figures out at runtime the most optimize query solution. &amp;nbsp;To use plinq all you have to do is&amp;nbsp;add AsParallel to your linq query and .NET takes care of the rest.&lt;br /&gt;
&lt;br /&gt;
Code Contracts was added to .NET to provide a non language specific way to express coding assumptions.  Basically you can specify preconditions, post conditions, and object invariants in order to improve testing via runtime checking and enable static contract verification, how this affects me, I’m not sure yet. &lt;br /&gt;
&lt;h4&gt;Improved Testing tools&lt;/h4&gt;An area that has come a long way in VS2010 are the testing tools, unfortunately some of the more interesting tools are only available in VS2010 Ultimate, but Microsoft did add a stand alone testing product called Microsoft Test and Lab Manager, this lets you do most of your test management with out VS. &lt;br /&gt;
&lt;br /&gt;
Testing features in VS2010:&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;UI testing tools that allow you to code/record UI tests, this looks kind of like the Art of Test (Telerik has a&amp;nbsp;re-branding) tool for Web testing but this supports all .NET UIs&lt;/li&gt;
&lt;li&gt;Test runner monitors what your testers are doing by allowing you to watch what's going on while testing in order to better track what the testers are doing, this includes customizable data collection to filter out&amp;nbsp;irrelevant&amp;nbsp;data, the ability to add video of how this bug was produced that can be added to the defect tracking system, and displays the&amp;nbsp;step by step&amp;nbsp;test steps to the testers . &lt;/li&gt;
&lt;li&gt;Virtual system manager (Hyper-V is supported but VMware and Virtual box support is expected post RTM) for setting up and managing testing environments.&lt;/li&gt;
&lt;li&gt;PEX- automated white box testing tool&lt;/li&gt;
&lt;li&gt;IntelliTrace is basically a trace and profile tool &lt;/li&gt;
&lt;li&gt;The test impact analysis tool specifies what test are going to be affected by code changes, for large code bases with lots of tests this allows more targeted testing for TDD.&lt;/li&gt;
&lt;/ul&gt;What you get in the Test Lab and Manager&lt;br /&gt;
&lt;ul&gt;&lt;li&gt;Test case management &lt;/li&gt;
&lt;li&gt;Create UI tests just like in VS2010&lt;/li&gt;
&lt;li&gt;Test runner for monitoring what your doing in the test just like in VS2010 &lt;/li&gt;
&lt;li&gt;Can import test cases from Excel &lt;/li&gt;
&lt;li&gt;Can configure testing data including network connectivity (throttling connectivity ) &lt;/li&gt;
&lt;/ul&gt;&lt;h4&gt;Team Foundation Server&lt;/h4&gt;&lt;div&gt;TFS &amp;nbsp;has an updated admin tool &lt;a href="http://www.codeplex.com/TFSAdmin" title="http://www.codeplex.com/TFSAdmin"&gt;http://www.codeplex.com/TFSAdmin&lt;/a&gt; that generally improves managing your server and users.  To better fit in the enterprise level space TFS also added clustering with load balancing and build server pooling; for small shops this may not be that big of a deal but it's nice to know for if and when you're no longer a small shop.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;One of the major complaints with TFS 2008 was the build system was painful to use and almost required a dedicated builder, this has been supposedly fixed with 2010 by moving to a work flow based build system, I'm waiting to see if this actually fixes the problem. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;An interesting new&amp;nbsp;addition&amp;nbsp;Excel Services&amp;nbsp;integration&amp;nbsp;in TFS. &amp;nbsp;This allows reporting, updating stories, tasks, test cases, etc. with out having to use the Test lab or VS2010. &amp;nbsp;The basic idea is the business people can use a tool they are familiar with to interact with TFS.  Also the excel service integration doesn't require any CALs to use.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;To my disappointment there is not a migration tool to move from other source control systems (subversion) to TFS yet, but supposedly it's on the way,  so if you're currently using subversion your going to have to wait.&lt;/div&gt;&lt;ul&gt;&lt;/ul&gt;&lt;h4&gt;Agile Software Development with TFS&lt;/h4&gt;&lt;div&gt;Some of the improvements to TFS are in it's support of agile development, with project templates for agile out of the box and the ability to customize your tickets (they are just xml). &amp;nbsp;All work items are queryable using Excel Services allowing your product owners and scrum master to know exactly what is going on at any time.  &lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;The build server now&amp;nbsp;supports&amp;nbsp;ATDD (Acceptance Test Driven Development) and tie in UI tests, Unit Tests, Integration Tests, etc. &lt;/div&gt;&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;div&gt;An interesting addition is the ability to create a team portal and wiki in Share point automatically.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;h4&gt;Conclusion&lt;/h4&gt;&lt;div&gt;I'm excited to start using VS2010 all in all I'm impressed with what it dose and how it works.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-1887318024370672404?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_aBHeNyH7xqDu0Rj-LArtU506jM/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_aBHeNyH7xqDu0Rj-LArtU506jM/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/_aBHeNyH7xqDu0Rj-LArtU506jM/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_aBHeNyH7xqDu0Rj-LArtU506jM/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/GF0CBta3laY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/GF0CBta3laY/vs2010-preview.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/04/vs2010-preview.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-352875114041085089</guid><pubDate>Fri, 29 Jan 2010 15:11:00 +0000</pubDate><atom:updated>2010-01-29T08:11:17.922-07:00</atom:updated><title>ASP.NET Controls, even the 3rd party controls are great, until you really try to use them</title><description>&lt;p&gt;Over the years I have had a kind of love hate relationship with asp.net web controls and after having some frustration recently I decided to rant about it.&lt;/p&gt;  &lt;p&gt;Conceptually it’s nice idea, the asp.net controls abstract away a lot of the “web development” so you can focus on just creating your application and not futzing around with html inputs, and creating elaborate javascript, and they give you a kind of sort of state;&amp;#160; and for about 90% of the time they do everything you want them to do.&amp;#160; &lt;/p&gt;  &lt;p&gt;Were they fall down is really in two places: &lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;In all reality not getting that last 10% really isn’t the controls fault it’s trying to be everything to every body and you really can’t do that.&amp;#160; This is even true the for expensive 3rd party controls, granted vendors like DevExpress, Component One, and Telerik make some very nice controls (a lot better then the stock controls from MS) I would even say they give you an additional 5%, and for the most part they make developing web forms easier and faster, BUT they still fall down when you really push them hard and then it feels like your spending all of your time tweaking their control verses just getting your application written.&amp;#160; &lt;/li&gt;    &lt;li&gt;The cost of getting that statefullness by using viewstate can sometimes crush your application, like most things it’s fine in moderation, unfortunately ViewState can quickly explode in size and blot your application, creating HUGE page sizes, slow responses and if it gets big enough it starts to corrupt and your applications starts to error, fun! Once again the 3rd party vendors tend to make better controls with less viewstate.&lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;So what is the solution, first learn about webforms controls and how they work, then create some server controls of your own.&amp;#160; If you look at previous posts I talk about how to create different types of controls and I’m only scratching the surface.&amp;#160; By rolling your own controls you can focus on getting them to do exactly what you want them to do and that might be the solution to getting the last 5% of the functionality you need.&amp;#160; Using Asp.net controls is one of the places where it’s really easy to get started with very little knowledge and quickly get sucked under.&amp;#160; This is defiantly a place where if you don’t understand how it works it can and will come back to get you.&amp;#160; &lt;/p&gt;  &lt;p&gt;Finally if you can’t get that last little bit of functionality, well for the most part you just have to deal with it.&amp;#160; Sorry to say but we are getting to a point where the development work on the web is going beyond what the underlying technology just can support.&amp;#160; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-352875114041085089?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/xXrn3LymIareeqcgxH81UxXqw0c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xXrn3LymIareeqcgxH81UxXqw0c/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/xXrn3LymIareeqcgxH81UxXqw0c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/xXrn3LymIareeqcgxH81UxXqw0c/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/EfOnVzP7FNs" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/EfOnVzP7FNs/aspnet-controls-even-3rd-party-controls.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/01/aspnet-controls-even-3rd-party-controls.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-7635268518345781184</guid><pubDate>Tue, 19 Jan 2010 06:56:00 +0000</pubDate><atom:updated>2010-01-18T23:59:53.240-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">Tools</category><category domain="http://www.blogger.com/atom/ns#">Development</category><category domain="http://www.blogger.com/atom/ns#">Design Patterns</category><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Unit Testing For Javascript</title><description>&lt;p&gt;Recently I had to write some fairly substantial javascript, and in the process I was reminded of how fast javascript, like most scripting languages, and get out of hand really quick.  I took a step back and thought why should I work in javascript any different then I do in other language?  Just because it’s a scripting language doesn't make it any less valid of a development platform, and I can apply the same design pattern and principles I would with anything else.  &lt;/p&gt;  &lt;p&gt;So The first thing I did was went looking for a unit testing framework and I found JSUnit.  JSUnit is available from &lt;a title="http://www.jsunit.net/" href="http://www.jsunit.net/"&gt;http://www.jsunit.net/&lt;/a&gt; and is a port of the JUnit framework to javascript.  The entire testing framework and test runner is written in javascript so I can use it anywhere you use javascript and in any development platform(php, ruby, Perl, java, .net, etc).  &lt;/p&gt;  &lt;p&gt;Getting started I have this javascript function I want to test&lt;/p&gt;  &lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;   &lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;     &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;function&lt;/span&gt; addTwoNumber(x, y) {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;var&lt;/span&gt; result = x + y;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; result;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;so first I create an html page and add the jsUnitCore.js and my .js file containing this function (almost all of your javascript really should be in .js files for a number of reasons, but that’s another blog post).&lt;/p&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;html&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt;     &amp;lt;head&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;         &amp;lt;script language=&lt;span style="color: rgb(0, 96, 128);"&gt;"JavaScript"&lt;/span&gt; src=&lt;span style="color: rgb(0, 96, 128);"&gt;"jsUnitCore.js"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;         &amp;lt;script language=&lt;span style="color: rgb(0, 96, 128);"&gt;"JavaScript"&lt;/span&gt; src=&lt;span style="color: rgb(0, 96, 128);"&gt;"javascriptCode.js"&lt;/span&gt;&amp;gt;&amp;lt;/script&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     &amp;lt;/head&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;     &amp;lt;body&amp;gt;        &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;     &amp;lt;/body&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt; &amp;lt;/html&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;then to add test cases I create functions inside a script tag in the body of the html page like so&lt;/p&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &amp;lt;body&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt;     &amp;lt;script type=&lt;span style="color: rgb(0, 96, 128);"&gt;"text/javascript"&lt;/span&gt;&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;function&lt;/span&gt; test_addTwoNumber_TwoNumbersAreAdded() {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;var&lt;/span&gt; result = addTwoNumber(2, 2);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;             assertEquals(&lt;span style="color: rgb(0, 96, 128);"&gt;"Adds 2 values together"&lt;/span&gt;, 4, result);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;         }&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;  &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;     &amp;lt;/script&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt; &amp;lt;/body&amp;gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;to tag a function as a test, simply start the function off with the text “test” and the test runner will pick it up and run it.  The assert is done with the function assertEquals provided by the jsUnitCore.js file and takes 3 prams (test description, expected value, and actual result) and to run the test you simply open the testRunner.html page in the jsunit dir in a browser&lt;br /&gt;&lt;br /&gt;&lt;p&gt;&lt;a href="http://lh4.ggpht.com/_zaoxdB0LbCU/S1VXlDHijPI/AAAAAAAAAD0/veGS0bCHDzM/s1600-h/image%5B3%5D.png"&gt;&lt;img style="border: 0px none ; display: inline;" title="image" alt="image" src="http://lh3.ggpht.com/_zaoxdB0LbCU/S1VXloDHKAI/AAAAAAAAAD4/Fe6pl6ZnbtA/image_thumb%5B1%5D.png?imgmax=800" border="0" height="344" width="537" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;then add the file location and run the tests, it’s that simple.  If you look at the screen shot you will notice that I’m using opera, for what ever reason I couldn’t get the test runner to work in Firefox, every time I would try and run my test file I would get a time out error, The funny thing is it works in IE, Chrome, and Opera just fine, weird.       &lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-7635268518345781184?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/lfwKoyYkB4ddKQsa7rObyGrgFMo/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lfwKoyYkB4ddKQsa7rObyGrgFMo/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/lfwKoyYkB4ddKQsa7rObyGrgFMo/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/lfwKoyYkB4ddKQsa7rObyGrgFMo/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/xFtdXZOMMiY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/xFtdXZOMMiY/unit-testing-for-javascript.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_zaoxdB0LbCU/S1VXloDHKAI/AAAAAAAAAD4/Fe6pl6ZnbtA/s72-c/image_thumb%5B1%5D.png?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2010/01/unit-testing-for-javascript.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-772979272285758777</guid><pubDate>Sun, 13 Dec 2009 06:41:00 +0000</pubDate><atom:updated>2009-12-12T23:54:24.229-07:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">javascript</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">ASP.NET</category><category domain="http://www.blogger.com/atom/ns#">WCF</category><title>Using WCF to build fast and lean web applications</title><description>&lt;p&gt;Recently I ran into a problem where I needed to reduce the size of a page, we had a page with a lot of drop down controls that may or my not be used.  The problem with this was the size of the html was huge, every one of the controls was fully populated with over 50 items, next the view state was equally huge storing all of that content.  The Solution, using WCF to load the control’s content on demand.&lt;/p&gt;  &lt;p&gt;Starting off we need to get WCF configured, and this confused me, I had to manually register WCF in IIS, WHAT!! ok to save you the hassle of having to research how to do this, execute c:\WINDOWS\Microsoft.NET\Framework\v3.0\Windows Communication Foundation\ServiceModelReg.exe –i and your good to go.&lt;/p&gt;  &lt;p&gt;We have two options for populating the dropdowns, you can use a 3rd party control like Telerik’s radcombobox, or roll your own, which in some ways is fairly simple but rather involved, for right now I’m going to show you how to roll your own, to see how to use radComboBox &lt;a href="http://www.telerik.com/help/aspnet-ajax/combobox-loading-items-from-wcf-service.html"&gt;see here&lt;/a&gt;. &lt;/p&gt;  &lt;p&gt;Lets start with the WCF service, create a Ajax enabled WCF service.  For what ever reason I had to remove the namespace to get this to work, and the examples I found online had it removed as well, this is something I’m going to research more on later.  Next we need to build a data entity to hold the data, nothing fancy just something like this&lt;/p&gt;  &lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;   &lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;     &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; Item&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; Text { get; set; }&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; Value { get; set;}&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;  &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; Items : Collection&amp;lt;Item&amp;gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt; {}&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;next we build the service, in this case I’m just building some data.&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; [ServiceContract(Namespace = &lt;span style="color: rgb(0, 96, 128);"&gt;""&lt;/span&gt;)]&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; DataService&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt; {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     [OperationContract]&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Items GetData()&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;         Items myItems = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Items();&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;for&lt;/span&gt; (&lt;span style="color: rgb(0, 0, 255);"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 5; i++)&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;         {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;             Item newItem = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Item()&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;                {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;                    Text = &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(0, 96, 128);"&gt;"value {0}"&lt;/span&gt;, i), &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;                    Value = i.ToString()&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;                };&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt;             myItems.Add(newItem);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt;  17:&lt;/span&gt;         }&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt;  18:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; myItems;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt;  19:&lt;/span&gt;     }&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum20"&gt;  20:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;when you add the Ajax enabled WCF service some items will be added to the system.serviceModel section of the web config in this case it looks like this&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behavior&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="DataServiceAspNetAjaxBehavior"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;      &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;enableWebScript&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behavior&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;endpointBehaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;behaviors&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;serviceHostingEnvironment&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;aspNetCompatibilityEnabled&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="true"&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;services&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;service&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="DataService"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;endpoint&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;address&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;=""&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;behaviorConfiguration&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="DataServiceAspNetAjaxBehavior"&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;      &lt;span style="color: rgb(255, 0, 0);"&gt;binding&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="webHttpBinding"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;contract&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="DataService"&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;    &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;service&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;   &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;   &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;services&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt;  &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;if your not able to get your service to work with the Namespace, and you remove it, make sure to also remove it from the contract attribute in the endpoint node of the service node.&lt;br /&gt;&lt;br /&gt;Next we add the service reference to the page using the script manager tag&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;asp:ScriptManager&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;ID&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="scriptManager"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;runat&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="server"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Services&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;asp:ServiceReference&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;Path&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="/DataService.svc"&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;Services&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;asp:ScriptManager&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;Now we can access the webservice with javascript.  First we need to have a dropdown control to work with, for this we are going to just use a plain old html select tag and add an ID and a runat=”server”.&lt;br /&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;select&lt;/span&gt; &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;id&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="dropDownList"&lt;/span&gt; &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;runat&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="server"&lt;/span&gt; &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;enableviewstate&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="false"&lt;/span&gt; &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;style&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="width:200px;"&lt;/span&gt; &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: rgb(255, 0, 0);"&gt;onfocus&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="populateDropDown(this);"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;select&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;    &lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;something else I have done here is I set enableviewstate="false" this solution doesn't use any view state so for the “cool kids” out there using MVC, this solution works for you as well.  Next add the javascript to populate our dropdown, as you can see in the select tag we have a populateDropDown function that is called with onfocus.&lt;br /&gt;   &lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;var&lt;/span&gt; Control;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;function&lt;/span&gt; populateDropDown(dropdown) {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     Control = dropdown;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     DataService.GetData(dropDownRequest_onSuccess, onFailure);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;Accessing the service is made easy by using the script manager, all we have to do is call javascript object created by the script manager with the same name as the service contract in this case it’s “DataService” and call the function with the same name as our service method “GetData”.  The function takes 2 delegate functions that act as event handlers as parameters, in this case it’s dropDownRequest_onSuccess and onFailure.  At this point I would like to say I’m in no way a javascript expert, if you know of a better way to any part of the javascript code by all means do it, and let me know.&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;var&lt;/span&gt; selectedOptionValue;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt;  &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;function&lt;/span&gt; dropDownRequest_onSuccess(result) {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     Control.options.length = 0;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;for&lt;/span&gt; (&lt;span style="color: rgb(0, 0, 255);"&gt;var&lt;/span&gt; x = 0; x &amp;lt; result.length; x++) {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;var&lt;/span&gt; opt = document.createElement(&lt;span style="color: rgb(0, 96, 128);"&gt;"option"&lt;/span&gt;);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;         opt.text = result[x].Text;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;         opt.value = result[x].Value;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (result[x].Value == selectedOptionValue) {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;             opt.setAttribute(&lt;span style="color: rgb(0, 96, 128);"&gt;"selected"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"true"&lt;/span&gt;);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;         }&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;         Control.options.add(opt);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;     }&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt; }&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;  &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;function&lt;/span&gt; onFailure(result) {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt;  17:&lt;/span&gt;     window.alert(result);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt;  18:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;The dropDownRequest_onSuccess function clears (if any) options from the select tag, then loops though the result from the webservice, creating option elements, setting their text and value then checking to see if the value matches the value of the selectedOptionValue var and if they do it sets that option as selected then adds it to the options collection of the select control. &lt;br /&gt;&lt;br /&gt;The onFailure is called when the service call fails, and for this we are just doing a simple alert to say it failed.&lt;br /&gt;&lt;br /&gt;The next part is getting the data out when the page is submitted, because we are &lt;strong&gt;not&lt;/strong&gt; using any view state we can’t get the value the same way we would with a regular asp.net control, we have to pull it from Request.Form collection.&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; value = Request.Form[dropDownList.ID];&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;Finally we need to add a way to set an option as selected.  The code to set the selected option is already there we just have to utilize it by setting the value of var selectedOptionValue, to do this we use the ClientScript.RegisterStartupScript like this  &lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; setValue()&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; script = &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(0, 96, 128);"&gt;"setpopulateDropdown('{0}',{1});"&lt;/span&gt;, dropDownList.ClientID, Request.Form[dropDownList.ID]);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     ClientScript.RegisterStartupScript(&lt;span style="color: rgb(0, 0, 255);"&gt;typeof&lt;/span&gt;(Page),&lt;span style="color: rgb(0, 96, 128);"&gt;"setDropdownValue"&lt;/span&gt;,script,&lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;to call this javascript function&lt;/p&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;function&lt;/span&gt; setpopulateDropdown(controlId, value) {&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt;     Control = document.getElementById(controlId);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     selectedOptionValue = value;&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     populateDropDown(Control);&lt;/pre&gt;    &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt; }&lt;/pre&gt;&lt;!--CRLF--&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;This sets the control to be updated, set the selected value, then populates the the control from the webservice.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Like I said it’s kind of a long process but you can cut down your page size a lot if your doing multiple dropdowns with large amounts of data that may not be used.&lt;/p&gt;&lt;p&gt;As always the full source code for this project is available (&lt;a href="http://bob-the-janitor-sample-code.googlecode.com/svn/trunk/usingJavascriptToPopulateDropDown/usingJavascriptToPopulateDropDown/"&gt;here&lt;/a&gt;).&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-772979272285758777?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/7RyOFA86OCnRgqqkvsXfadM24kE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7RyOFA86OCnRgqqkvsXfadM24kE/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/7RyOFA86OCnRgqqkvsXfadM24kE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/7RyOFA86OCnRgqqkvsXfadM24kE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/Puxwa7PA-kY" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/Puxwa7PA-kY/using-wcf-to-build-fast-and-lean-web.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2009/12/using-wcf-to-build-fast-and-lean-web.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-419926181891360551</guid><pubDate>Fri, 23 Oct 2009 06:13:00 +0000</pubDate><atom:updated>2009-10-23T07:06:09.928-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tools</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Visual Studio 2010</category><title>First look at Visual Studio 2010 Beta 2</title><description>&lt;p&gt;Visual studio 2010 Beta 2 is out, so lets take a look at some of the changes:  &lt;/p&gt; &lt;ol&gt; &lt;li&gt;The new WPF UI is a nice clean face lift.  &lt;/li&gt;&lt;li&gt;The new extension manager makes getting, updating, and managing plug-ins, templates, and controls(Telerik has almost their entire product line available) from the web easy, my only real issue with the extension manager is I can’t find a way to load plug-ins that aren’t in the gallery, and a lot of my favorite plug-ins(Ghost doc and R#) aren’t supported yet.  &lt;/li&gt;&lt;li&gt;The removal of the Team Studio versions, the Team Studio versions where confusing and over priced.  The new SKUs are VS 2010 Professional, VS 2010 Premium, and VS 2010 Ultimate. For the full product descriptions see the Visual Studio Product &lt;a href="http://www.microsoft.com/visualstudio/en-us/products/2010/default.mspx" target="_blank"&gt;page&lt;/a&gt;.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Some of the things that didn’t change:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Adding a reference is still slow and painful.  &lt;/li&gt;&lt;li&gt;The testing frame work really hasn't changed much, although the test seem to run faster.&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;Things that are not quite there yet:&lt;/p&gt; &lt;ol&gt; &lt;li&gt;Intellisense doesn’t work very well, but this may be a configuration setting.  &lt;/li&gt;&lt;li&gt;The number of supported plug-ins is limited, but that is understandable seeing that the plug-in model has completely changed&lt;/li&gt;&lt;/ol&gt; &lt;p&gt;All in all I really like Visual Studio 2010 and I’m really excited for when it’s ready for prime time.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-419926181891360551?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wQlZanDe8u591GTN8FFUpjzWYws/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wQlZanDe8u591GTN8FFUpjzWYws/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wQlZanDe8u591GTN8FFUpjzWYws/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wQlZanDe8u591GTN8FFUpjzWYws/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/MkzT9XuW4_I" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/MkzT9XuW4_I/first-look-at-visual-studio-2010-beta-2.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2009/10/first-look-at-visual-studio-2010-beta-2.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-7784881100568902331</guid><pubDate>Sat, 17 Oct 2009 14:52:00 +0000</pubDate><atom:updated>2009-10-17T08:54:02.979-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Tools</category><category domain="http://www.blogger.com/atom/ns#">Development</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">Documentation</category><title>Taking the pain out of code documentation</title><description>&lt;p&gt;I have never known a developer that liked writing document let alone writing code document, well I take that back there was one guy but he had *Issues* and we’ll just leave it at that.  I have heard all of the excuses, and in the end it still comes down to, we would rather write code then write about the code.&lt;/p&gt;  &lt;p&gt;One common statement coming from the TDD/DDD methodologies is that the unit tests document the code; while this is great if we have the unit test, but even then a little documentation would still be useful so we don’t have to dig though unit test to figure out how to use a library.  Another favorite excuse is the method names document themselves, granted having intelligently named methods and variables make understanding the code a lot easier(and we’ll get into that latter) but short of having the average method name be 40+ chars long this really isn’t practical either.&lt;/p&gt;  &lt;p&gt;Luckily the are some tools to make writing code documentation much easier.  For starters the .NET compiler can be configured to generate XML documentation files by setting an xml output file in the project build configuration. The xml content is created from specially formatted XML comments that looks like this&lt;/p&gt;  &lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;   &lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;     &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;/// Saves the contact.&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;param name="contact"&amp;gt;The contact to be saved.&amp;lt;/param&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;/// A true or false result of the successful saving this contact&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;/// &amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; SaveContact(Contact contact)&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;You can write this by hand or use a tool like the GhostDoc plug-in for Visual Studio.  GhostDoc will auto generate documentation based on configurable rules for the different objects, classes, method, properties, etc.  One of the very nice features about being able to configure the documentation rules is you can add additional item like remarks that say when it was documented and by who.  &lt;/p&gt;&lt;p&gt;The second nice thing about using GhostDoc is the rules used to figure out what to put into the documentation can be used to make sure your using intelligent names, it’s not always right but it can be a good indicator for how good of names your using. &lt;/p&gt;&lt;p&gt;So why add this? This gives you two advantages, first it adds intelligence for your code, next it allows you to create MSDN like documentation using the .NET documentation generator Sandcastle.&lt;/p&gt;&lt;p&gt;Sandcastle can be downloaded from &lt;a href="http://sandcastle.codeplex.com/"&gt;http://sandcastle.codeplex.com/&lt;/a&gt; and provides a command-line interface for building your documentation from the .dll and .XML file generated by the .net compiler making it easy to add documentation generation to your automated build system.  For the user it’s a little clunky and painful to use, if you want to build the documentation without scripting, there is an app for that, the Sandcastle Help File Builder located at &lt;a href="http://www.codeplex.com/SHFB"&gt;http://www.codeplex.com/SHFB&lt;/a&gt;.   &lt;/p&gt;&lt;p&gt;&lt;a href="http://lh4.ggpht.com/_zaoxdB0LbCU/StnaDuBECeI/AAAAAAAAACY/K-Op2avdqjs/s1600-h/sandcastle_builder%5B7%5D.jpg"&gt;&lt;img style="border: 0px none ; display: inline;" title="sandcastle_builder" alt="sandcastle_builder" src="http://lh3.ggpht.com/_zaoxdB0LbCU/StnaEE0Bp6I/AAAAAAAAACc/B33hSCUHwy4/sandcastle_builder_thumb%5B3%5D.jpg?imgmax=800" width="518" border="0" height="358" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;Basically this lets you build a configuration that can include what is documented, the layout of the documentation, adding headers, footers, errors for missing items etc. and when you’re all said and done you get documentation that looks like this&lt;/p&gt;&lt;p&gt;&lt;a href="http://lh4.ggpht.com/_zaoxdB0LbCU/StnaElz4bNI/AAAAAAAAACg/R6P0IYv8gRs/s1600-h/sandcastle_documentation%5B4%5D.jpg"&gt;&lt;img style="border: 0px none ; display: inline;" title="sandcastle_documentation" alt="sandcastle_documentation" src="http://lh4.ggpht.com/_zaoxdB0LbCU/StnaFaK5-bI/AAAAAAAAACk/uydhMj6mwEM/sandcastle_documentation_thumb%5B2%5D.jpg?imgmax=800" width="530" border="0" height="342" /&gt;&lt;/a&gt; &lt;/p&gt;&lt;p&gt;it’s that easy.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-7784881100568902331?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/57aI-wPAxukgb8xgl_9nPVvY4A8/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/57aI-wPAxukgb8xgl_9nPVvY4A8/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/57aI-wPAxukgb8xgl_9nPVvY4A8/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/57aI-wPAxukgb8xgl_9nPVvY4A8/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/Or_EWfyp8WQ" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/Or_EWfyp8WQ/taking-pain-out-of-code-documentation.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://lh3.ggpht.com/_zaoxdB0LbCU/StnaEE0Bp6I/AAAAAAAAACc/B33hSCUHwy4/s72-c/sandcastle_builder_thumb%5B3%5D.jpg?imgmax=800" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2009/10/taking-pain-out-of-code-documentation.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-8795033393040190326</guid><pubDate>Wed, 14 Oct 2009 07:04:00 +0000</pubDate><atom:updated>2009-10-14T01:11:01.831-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Refactoring</category><category domain="http://www.blogger.com/atom/ns#">Development</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Design Patterns</category><category domain="http://www.blogger.com/atom/ns#">Best Practices</category><category domain="http://www.blogger.com/atom/ns#">IOC</category><category domain="http://www.blogger.com/atom/ns#">C#</category><category domain="http://www.blogger.com/atom/ns#">System Architecture</category><category domain="http://www.blogger.com/atom/ns#">TDD</category><title>Not ready for Inversion Of Control, just use a factory for now</title><description>&lt;p&gt;There has been a lot of discussion latterly in the blog world about using inversion of control or IOC, some claiming it’s to hard to understand, it complicates development, and it’s unnecessary; the other side saying quit complaining it’s not that hard, it enforces good design and makes code more maintainable.  To this I’m going to take the vary controversial position that they are both right.&lt;/p&gt;  &lt;p&gt;Inversion of control can be intimidation the first time you use it, it adds a bit of complexity and you can write quality applications with out it.  On the other side once you “get it” IOC really isn't that hard it encourages separation of responsibilities, and makes it much easier to test making regression testing and refactoring much easier.    &lt;/p&gt;  &lt;p&gt;So how do we get all of the advantages with out adding all of the complexities of an IOC container, simple just use a software factory class.  For those who don’t know, basically a factory class is just away to abstract and consolidate the logic for getting your code dependencies.&lt;/p&gt;  &lt;p&gt;Let’s say you have some code for accessing data from Amazon’s simpleDB &lt;/p&gt;  &lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;   &lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;     &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; ContactData : IContactData&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; Proxy simpleDBProxy;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Proxy SimpleDBProxy&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;         get&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (simpleDBProxy==&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;                 simpleDBProxy = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Proxy();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; simpleDBProxy;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;         set&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt;             simpleDBProxy = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt;  17:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt;  19:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; DomainName = &lt;span style="color: rgb(0, 96, 128);"&gt;"Contacts"&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum20"&gt;  20:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum21"&gt;  21:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Contacts GetContacts()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum22"&gt;  22:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum23"&gt;  23:&lt;/span&gt;         Contacts myContacts = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Contacts();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum24"&gt;  24:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum25"&gt;  25:&lt;/span&gt;         SelectRequest request = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SelectRequest&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum26"&gt;  26:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum27"&gt;  27:&lt;/span&gt;             SelectExpression = &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(0, 96, 128);"&gt;"SELECT * FROM {0} "&lt;/span&gt;, DomainName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum28"&gt;  28:&lt;/span&gt;         };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum29"&gt;  29:&lt;/span&gt;         SelectResponse response = SimpleDBProxy.Service.Select(request);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum30"&gt;  30:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum31"&gt;  31:&lt;/span&gt;         var contacts = from item &lt;span style="color: rgb(0, 0, 255);"&gt;in&lt;/span&gt; response.SelectResult.Item&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum32"&gt;  32:&lt;/span&gt;                          select &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Contact()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum33"&gt;  33:&lt;/span&gt;                                     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum34"&gt;  34:&lt;/span&gt;                                         Email = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Email"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum35"&gt;  35:&lt;/span&gt;                                         Name = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum36"&gt;  36:&lt;/span&gt;                                         Phone = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Phone"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum37"&gt;  37:&lt;/span&gt;                                         ID =  item.Name&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum38"&gt;  38:&lt;/span&gt;                                     };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum39"&gt;  39:&lt;/span&gt;         myContacts.AddRange(contacts);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum40"&gt;  40:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; myContacts;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum41"&gt;  41:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum42"&gt;  42:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum43"&gt;  43:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Contacts GetContactsByName(&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; contactName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum44"&gt;  44:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum45"&gt;  45:&lt;/span&gt;         Contacts myContacts = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Contacts();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum46"&gt;  46:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum47"&gt;  47:&lt;/span&gt;         SelectRequest request = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SelectRequest&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum48"&gt;  48:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum49"&gt;  49:&lt;/span&gt;             SelectExpression = &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(0, 96, 128);"&gt;"SELECT * FROM {0} where Name='{1}' "&lt;/span&gt;, DomainName, contactName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum50"&gt;  50:&lt;/span&gt;         };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum51"&gt;  51:&lt;/span&gt;         SelectResponse response = SimpleDBProxy.Service.Select(request);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum52"&gt;  52:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum53"&gt;  53:&lt;/span&gt;         var contacts = from item &lt;span style="color: rgb(0, 0, 255);"&gt;in&lt;/span&gt; response.SelectResult.Item&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum54"&gt;  54:&lt;/span&gt;                        select &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Contact()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum55"&gt;  55:&lt;/span&gt;                        {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum56"&gt;  56:&lt;/span&gt;                            Email = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Email"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum57"&gt;  57:&lt;/span&gt;                            Name = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum58"&gt;  58:&lt;/span&gt;                            Phone = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Phone"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum59"&gt;  59:&lt;/span&gt;                            ID = item.Name&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum60"&gt;  60:&lt;/span&gt;                        };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum61"&gt;  61:&lt;/span&gt;         myContacts.AddRange(contacts);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum62"&gt;  62:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; myContacts;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum63"&gt;  63:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum64"&gt;  64:&lt;/span&gt;    &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum65"&gt;  65:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; SaveContact(Contact contact)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum66"&gt;  66:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum67"&gt;  67:&lt;/span&gt;         List&amp;lt;ReplaceableAttribute&amp;gt; attributeList = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; List&amp;lt;ReplaceableAttribute&amp;gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum68"&gt;  68:&lt;/span&gt;            {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum69"&gt;  69:&lt;/span&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ReplaceableAttribute().WithName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Email"&lt;/span&gt;).WithValue(contact.Email),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum70"&gt;  70:&lt;/span&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ReplaceableAttribute().WithName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;).WithValue(contact.Name),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum71"&gt;  71:&lt;/span&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ReplaceableAttribute().WithName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Phone"&lt;/span&gt;).WithValue(contact.Phone)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum72"&gt;  72:&lt;/span&gt;            };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum73"&gt;  73:&lt;/span&gt;         contact.ID = Guid.NewGuid().ToString();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum74"&gt;  74:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; success = &lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum75"&gt;  75:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum76"&gt;  76:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum77"&gt;  77:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (!SimpleDBProxy.Domains.Contains(DomainName))&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum78"&gt;  78:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum79"&gt;  79:&lt;/span&gt;                 SimpleDBProxy.AddDomain(DomainName);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum80"&gt;  80:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum81"&gt;  81:&lt;/span&gt;             PutAttributesRequest action = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; PutAttributesRequest&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum82"&gt;  82:&lt;/span&gt;               {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum83"&gt;  83:&lt;/span&gt;                   ItemName = contact.ID,&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum84"&gt;  84:&lt;/span&gt;                   Attribute = attributeList,&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum85"&gt;  85:&lt;/span&gt;                   DomainName = DomainName&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum86"&gt;  86:&lt;/span&gt;               };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum87"&gt;  87:&lt;/span&gt;             PutAttributesResponse response = SimpleDBProxy.Service.PutAttributes(action);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum88"&gt;  88:&lt;/span&gt;             success = &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum89"&gt;  89:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum90"&gt;  90:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt; (Exception requestException)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum91"&gt;  91:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum92"&gt;  92:&lt;/span&gt;             success = &lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum93"&gt;  93:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum94"&gt;  94:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum95"&gt;  95:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; success;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum96"&gt;  96:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum97"&gt;  97:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;now because this implements the IContactData interface &lt;/p&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;interface&lt;/span&gt; IContactData&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     Contacts GetContacts();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     Contacts GetContactsByName(&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; contactName);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; SaveContact(Contact contact);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;we can use it anywhere we would use IContactData, for example here we have an application that uses both local and remote contacts&lt;/p&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; ContactsRequests&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; IContactData ContactData;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; UseLocalContacts { get;set; }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Contacts SearchContactsByName(&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; contactName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (UseLocalContacts)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;             ContactData = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; LocalContactData();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;             ContactData = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ContactData();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; ContactData.GetContactsByName(contactName);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt;  17:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt;  18:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt;  19:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Contacts GetContacts()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum20"&gt;  20:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum21"&gt;  21:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (UseLocalContacts)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum22"&gt;  22:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum23"&gt;  23:&lt;/span&gt;             ContactData = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; LocalContactData();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum24"&gt;  24:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum25"&gt;  25:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum26"&gt;  26:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum27"&gt;  27:&lt;/span&gt;             ContactData = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ContactData();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum28"&gt;  28:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum29"&gt;  29:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; ContactData.GetContacts();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum30"&gt;  30:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum31"&gt;  31:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum32"&gt;  32:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; AddContact(Contact newContact)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum33"&gt;  33:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum34"&gt;  34:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; ContactData.SaveContact(newContact);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum35"&gt;  35:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum36"&gt;  36:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;now this works but there are a few problems, first there is no way to test it’s functionality without testing the functionality of LocalContactData and/or ContactData with a little simple refactoring &lt;/p&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; ContactsRequests&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; IContactData contactData;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; IContactData ContactData&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;         get&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (contactData==&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;                 &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (UseLocalContacts)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;                 {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;                     contactData = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; LocalContactData();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;                 }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;                 &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;                 {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt;                     contactData = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ContactData();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt;  17:&lt;/span&gt;                 }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt;  18:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt;  19:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; contactData;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum20"&gt;  20:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum21"&gt;  21:&lt;/span&gt;         set&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum22"&gt;  22:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum23"&gt;  23:&lt;/span&gt;             contactData = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum24"&gt;  24:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum25"&gt;  25:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum26"&gt;  26:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; UseLocalContacts { get;set; }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum27"&gt;  27:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum28"&gt;  28:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Contacts SearchContactsByName(&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; contactName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum29"&gt;  29:&lt;/span&gt;     {          &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum30"&gt;  30:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; ContactData.GetContactsByName(contactName);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum31"&gt;  31:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum32"&gt;  32:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum33"&gt;  33:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Contacts GetContacts()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum34"&gt;  34:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum35"&gt;  35:&lt;/span&gt;        &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; ContactData.GetContacts();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum36"&gt;  36:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum37"&gt;  37:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum38"&gt;  38:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; AddContact(Contact newContact)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum39"&gt;  39:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum40"&gt;  40:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; ContactData.SaveContact(newContact);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum41"&gt;  41:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum42"&gt;  42:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;we remove the instantiation logic from the method and move it to a public property this way we can set the ContactData property to a  mock object and test the specific logic of the methods in this class, now the only problem with this is everywhere we want to use IContactData we have to perform the same logic, and basically reproduce the same code over and over again.  This is where factories come in, if we build a factory like this&lt;br /&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; DataFactories&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; IContactData GetContactInterface(&lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; isLocal)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;         IContactData myContactData;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (isLocal)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;             myContactData = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; LocalContactData();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;else&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;             myContactData= &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ContactData();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; myContactData;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Then we just implement it like this &lt;/p&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; IContactData ContactData&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     get&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (contactData==&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;             contactData = DataFactories.GetContactInterface(UseLocalContacts);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; contactData;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;     set&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;         contactData = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;your applications don’t know or care how they got there class for getting contact all they know is they did, where this really comes in handy is if you have to change out how you handle your local contacts from let’s say an xml file to a database, the only place you have to change your code is in the factory.&lt;/p&gt;&lt;p&gt;Congratulations you are now 90% of the way there for using a IOC container, you have a single place for handling all of your instantiation so once you decide to use IOC you just change how the factory works from having logic that decides what class to insatiate to pulling it from the IOC container, it’s that simple.&lt;/p&gt;&lt;p&gt;Truth be told I always start with a factory and then later “IF” I need the functionality of an IOC I’ll add it.  In the end an IOC container really isn’t nearly as scary as it seems to be, and in the same token it isn’t nearly a vital as some people would like to claim, it’s a tool that can be used to solve specific problems, but 90% of the same problems can be solved using a factory.&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/1759021816486600143-8795033393040190326?l=bob-the-janitor.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/wMdnQm9o7hf4_74EBDZdSATVKtA/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wMdnQm9o7hf4_74EBDZdSATVKtA/0/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;br/&gt;
&lt;a href="http://feedads.g.doubleclick.net/~a/wMdnQm9o7hf4_74EBDZdSATVKtA/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/wMdnQm9o7hf4_74EBDZdSATVKtA/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;img src="http://feeds.feedburner.com/~r/TheJanitorsCloset/~4/nyRKeYNMJ00" height="1" width="1"/&gt;</description><link>http://feedproxy.google.com/~r/TheJanitorsCloset/~3/nyRKeYNMJ00/not-ready-for-inversion-of-control-just.html</link><author>noreply@blogger.com (Bob The Janitor (Richard))</author><thr:total>1</thr:total><feedburner:origLink>http://bob-the-janitor.blogspot.com/2009/10/not-ready-for-inversion-of-control-just.html</feedburner:origLink></item><item><guid isPermaLink="false">tag:blogger.com,1999:blog-1759021816486600143.post-7070052782672905683</guid><pubDate>Wed, 07 Oct 2009 05:49:00 +0000</pubDate><atom:updated>2009-10-07T00:26:13.519-06:00</atom:updated><category domain="http://www.blogger.com/atom/ns#">Development</category><category domain="http://www.blogger.com/atom/ns#">.NET</category><category domain="http://www.blogger.com/atom/ns#">Data Access</category><category domain="http://www.blogger.com/atom/ns#">C#</category><title>A walk in the clouds with SimpleDB</title><description>&lt;p&gt;For starters I’m a cloud skeptic, I think it’s too new and untested to make any real long term predictions about where it’s going to go, but having said that it looks very interesting, and if you don’t have the hardware it can be a very inexpensive way to have a very scalable application.&lt;/p&gt;  &lt;h4&gt;Signing up with Amazon&lt;/h4&gt;  &lt;p&gt;For starters go to &lt;a title="http://aws.amazon.com/simpledb/" href="http://aws.amazon.com/simpledb/"&gt;http://aws.amazon.com/simpledb/&lt;/a&gt; and click on the signup and create an account which requires a credit card, just so you know. &lt;/p&gt;  &lt;p&gt;As far as the cost, it really is very reasonable to free, based on your monthly usage with the first 25 Machine Hours free and each additional hour costing $0.140, your first GB of storage is free with each additional GB costing $0.25 per GB Per month. For bandwidth your 1st GB of data upload is free with each additional GB costing $0.10; your first GB of download is free with the following price structure for additional download badwith &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;$0.170 per GB - first 10 TB / month data transfer out &lt;/li&gt;    &lt;li&gt;$0.130 per GB - next 40 TB / month data transfer out &lt;/li&gt;    &lt;li&gt;$0.110 per GB - next 100 TB / month data transfer out &lt;/li&gt;    &lt;li&gt;$0.100 per GB - data transfer out / month over 150 TB &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;While setting up the account was easy, there site is confusing, hard to navigate, and frustrating, my biggest complaint is I have to resign in constantly. &lt;/p&gt;  &lt;h4&gt;Getting the Amazon Tools&lt;/h4&gt;  &lt;p&gt;Finding the C# Library for Amazon SimpleDB is a pain, so I’m kindly providing you a &lt;a href="http://developer.amazonwebservices.com/connect/entry%21default.jspa?categoryID=114&amp;amp;externalID=1133&amp;amp;fromSearchPage=true"&gt;link&lt;/a&gt;, now this is just source code, which is kind of irritating, why can’t they just give me the DLLs, but on the other side I can look at what they are doing, and how they do it.&lt;/p&gt;  &lt;h4&gt;Using the Amazon Tools&lt;/h4&gt;  &lt;p&gt;The first thing to do is build a proxy for interfacing with the simpleDB web service, something like this&lt;/p&gt;  &lt;div class="csharpcode"&gt;   &lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;     &lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;       &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; Proxy&lt;/pre&gt;      &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;      &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; PublicKey = String.Empty;&lt;/pre&gt;      &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; SecretKey = String.Empty;&lt;/pre&gt;      &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; AmazonSimpleDBClient Service{ get; set;}&lt;/pre&gt;      &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; List&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt; domains;&lt;/pre&gt;      &lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; List&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt; Domains&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;         get&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (domains==&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;                 domains = GetDomains();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; domains;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt;  17:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt;  18:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt;  19:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Proxy()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum20"&gt;  20:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum21"&gt;  21:&lt;/span&gt;         PublicKey = ConfigurationManager.AppSettings[&lt;span style="color: rgb(0, 96, 128);"&gt;"PublicKey"&lt;/span&gt;];&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum22"&gt;  22:&lt;/span&gt;         SecretKey = ConfigurationManager.AppSettings[&lt;span style="color: rgb(0, 96, 128);"&gt;"SecretKey"&lt;/span&gt;];&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum23"&gt;  23:&lt;/span&gt;         Service = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; AmazonSimpleDBClient(PublicKey, SecretKey);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum24"&gt;  24:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum25"&gt;  25:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum26"&gt;  26:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; List&amp;lt;&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;&amp;gt; GetDomains()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum27"&gt;  27:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum28"&gt;  28:&lt;/span&gt;         ListDomainsRequest ListDomainsAction = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ListDomainsRequest();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum29"&gt;  29:&lt;/span&gt;         ListDomainsResponse response = Service.ListDomains(ListDomainsAction);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum30"&gt;  30:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; response.ListDomainsResult.DomainName;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum31"&gt;  31:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum32"&gt;  32:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum33"&gt;  33:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; AddDomain(&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; domainName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum34"&gt;  34:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum35"&gt;  35:&lt;/span&gt;         CreateDomainRequest myCreateDomainRequest = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; CreateDomainRequest {DomainName = domainName};&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum36"&gt;  36:&lt;/span&gt;         CreateDomainResponse response = Service.CreateDomain(myCreateDomainRequest);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum37"&gt;  37:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum38"&gt;  38:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum39"&gt;  39:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; DeleteDomain(&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; domainName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum40"&gt;  40:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum41"&gt;  41:&lt;/span&gt;         DeleteDomainRequest request = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; DeleteDomainRequest {DomainName = domainName};&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum42"&gt;  42:&lt;/span&gt;         DeleteDomainResponse response = Service.DeleteDomain(request);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum43"&gt;  43:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum44"&gt;  44:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;This class provides several things, first it sets the public and secret keys for simpleDB, this is basically your authentication to simpleDB, as you can see I’m using an app setting to store this. The next important thing is the AmazonSimpleDBClient property called service, this is how you interact with simpleDB. Last you have the Domain methods, these are used to get what domains you have, add new domains, and finally delete unused domains.&lt;/p&gt;&lt;p&gt;Now we have our proxy lets build something that uses it&lt;/p&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;" id="codeSnippet"&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt;   1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; ContactData&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt;   2:&lt;/span&gt; {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt;   3:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; Proxy simpleDBProxy;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt;   4:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Proxy SimpleDBProxy&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt;   5:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt;   6:&lt;/span&gt;         get&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt;   7:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt;   8:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (simpleDBProxy==&lt;span style="color: rgb(0, 0, 255);"&gt;null&lt;/span&gt;)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt;   9:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt;  10:&lt;/span&gt;                 simpleDBProxy = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Proxy();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt;  11:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt;  12:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; simpleDBProxy;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt;  13:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt;  14:&lt;/span&gt;         set&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt;  15:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt;  16:&lt;/span&gt;             simpleDBProxy = &lt;span style="color: rgb(0, 0, 255);"&gt;value&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt;  17:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt;  18:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt;  19:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;const&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; DomainName = &lt;span style="color: rgb(0, 96, 128);"&gt;"Contacts"&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum20"&gt;  20:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum21"&gt;  21:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Contacts GetContacts()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum22"&gt;  22:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum23"&gt;  23:&lt;/span&gt;         Contacts myContacts = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Contacts();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum24"&gt;  24:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum25"&gt;  25:&lt;/span&gt;         SelectRequest request = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SelectRequest&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum26"&gt;  26:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum27"&gt;  27:&lt;/span&gt;             SelectExpression = &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(0, 96, 128);"&gt;"SELECT * FROM {0} "&lt;/span&gt;, DomainName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum28"&gt;  28:&lt;/span&gt;         };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum29"&gt;  29:&lt;/span&gt;         SelectResponse response = SimpleDBProxy.Service.Select(request);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum30"&gt;  30:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum31"&gt;  31:&lt;/span&gt;         var contacts = from item &lt;span style="color: rgb(0, 0, 255);"&gt;in&lt;/span&gt; response.SelectResult.Item&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum32"&gt;  32:&lt;/span&gt;                          select &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Contact()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum33"&gt;  33:&lt;/span&gt;                                     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum34"&gt;  34:&lt;/span&gt;                                         Email = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Email"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum35"&gt;  35:&lt;/span&gt;                                         Name = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum36"&gt;  36:&lt;/span&gt;                                         Phone = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Phone"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum37"&gt;  37:&lt;/span&gt;                                         ID =  item.Name&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum38"&gt;  38:&lt;/span&gt;                                     };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum39"&gt;  39:&lt;/span&gt;         myContacts.AddRange(contacts);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum40"&gt;  40:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; myContacts;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum41"&gt;  41:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum42"&gt;  42:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum43"&gt;  43:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; Contacts GetContactsByName(&lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt; contactName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum44"&gt;  44:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum45"&gt;  45:&lt;/span&gt;         Contacts myContacts = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Contacts();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum46"&gt;  46:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum47"&gt;  47:&lt;/span&gt;         SelectRequest request = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SelectRequest&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum48"&gt;  48:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum49"&gt;  49:&lt;/span&gt;             SelectExpression = &lt;span style="color: rgb(0, 0, 255);"&gt;string&lt;/span&gt;.Format(&lt;span style="color: rgb(0, 96, 128);"&gt;"SELECT * FROM {0} where Name='{1}' "&lt;/span&gt;, DomainName, contactName)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum50"&gt;  50:&lt;/span&gt;         };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum51"&gt;  51:&lt;/span&gt;         SelectResponse response = SimpleDBProxy.Service.Select(request);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum52"&gt;  52:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum53"&gt;  53:&lt;/span&gt;         var contacts = from item &lt;span style="color: rgb(0, 0, 255);"&gt;in&lt;/span&gt; response.SelectResult.Item&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum54"&gt;  54:&lt;/span&gt;                        select &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Contact()&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum55"&gt;  55:&lt;/span&gt;                        {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum56"&gt;  56:&lt;/span&gt;                            Email = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Email"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum57"&gt;  57:&lt;/span&gt;                            Name = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum58"&gt;  58:&lt;/span&gt;                            Phone = item.Attribute.GetValueByName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Phone"&lt;/span&gt;),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum59"&gt;  59:&lt;/span&gt;                            ID = item.Name&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum60"&gt;  60:&lt;/span&gt;                        };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum61"&gt;  61:&lt;/span&gt;         myContacts.AddRange(contacts);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum62"&gt;  62:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; myContacts;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum63"&gt;  63:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum64"&gt;  64:&lt;/span&gt;    &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum65"&gt;  65:&lt;/span&gt;     &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; SaveContact(Contact contact)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum66"&gt;  66:&lt;/span&gt;     {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum67"&gt;  67:&lt;/span&gt;         List&amp;lt;ReplaceableAttribute&amp;gt; attributeList = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; List&amp;lt;ReplaceableAttribute&amp;gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum68"&gt;  68:&lt;/span&gt;            {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum69"&gt;  69:&lt;/span&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ReplaceableAttribute().WithName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Email"&lt;/span&gt;).WithValue(contact.Email),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum70"&gt;  70:&lt;/span&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ReplaceableAttribute().WithName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;).WithValue(contact.Name),&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum71"&gt;  71:&lt;/span&gt;                &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; ReplaceableAttribute().WithName(&lt;span style="color: rgb(0, 96, 128);"&gt;"Phone"&lt;/span&gt;).WithValue(contact.Phone)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum72"&gt;  72:&lt;/span&gt;            };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum73"&gt;  73:&lt;/span&gt;         contact.ID = Guid.NewGuid().ToString();&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum74"&gt;  74:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;bool&lt;/span&gt; success = &lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum75"&gt;  75:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;try&lt;/span&gt;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum76"&gt;  76:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum77"&gt;  77:&lt;/span&gt;             &lt;span style="color: rgb(0, 0, 255);"&gt;if&lt;/span&gt; (!SimpleDBProxy.Domains.Contains(DomainName))&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum78"&gt;  78:&lt;/span&gt;             {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum79"&gt;  79:&lt;/span&gt;                 SimpleDBProxy.AddDomain(DomainName);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum80"&gt;  80:&lt;/span&gt;             }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum81"&gt;  81:&lt;/span&gt;             PutAttributesRequest action = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; PutAttributesRequest&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum82"&gt;  82:&lt;/span&gt;               {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum83"&gt;  83:&lt;/span&gt;                   ItemName = contact.ID,&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum84"&gt;  84:&lt;/span&gt;                   Attribute = attributeList,&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum85"&gt;  85:&lt;/span&gt;                   DomainName = DomainName&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum86"&gt;  86:&lt;/span&gt;               };&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum87"&gt;  87:&lt;/span&gt;             PutAttributesResponse response = SimpleDBProxy.Service.PutAttributes(action);&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum88"&gt;  88:&lt;/span&gt;             success = &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum89"&gt;  89:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum90"&gt;  90:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;catch&lt;/span&gt; (Exception requestException)&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum91"&gt;  91:&lt;/span&gt;         {&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum92"&gt;  92:&lt;/span&gt;             success = &lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum93"&gt;  93:&lt;/span&gt;         }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum94"&gt;  94:&lt;/span&gt;  &lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum95"&gt;  95:&lt;/span&gt;         &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; success;&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum96"&gt;  96:&lt;/span&gt;     }&lt;/pre&gt;&lt;pre    style="border-style: none; margin: 0em; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; background-color: white; width: 100%; direction: ltr;font-family:'Courier New',courier,monospace;font-size:8pt;color:black;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum97"&gt;  97:&lt;/span&gt; }&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;&lt;p&gt;Here we have a simple example of how to add/get items from simpleDB, one important thing to note is the IDs are GUIDs, this is because the objects don’t get and incrementing index ID you need to get a unique identifier and the easiest way to do that is to just used a GUID. &lt;/p&gt;&lt;p&gt;One thing you will notice is I have added some extension method helpers for getting the data out, this is just a way to simplify getting your data back out.&lt;/p&gt;&lt;div   style="border: 1px solid silver; margin: 20px 0px 10px; padding: 4px; overflow: auto; text-align: left; line-height: 12pt; background-color: rgb(244, 244, 244); width: 97.5%; direction: ltr; max-height: 200px; cursor: text;font-family:'Courier New',courier,monospace;font-size:8pt;" id="codeSnippetWrapper"&gt;&lt;div    style="border-style: none; padding: 0px; overflow: visible; text-align: left; line-height: 12pt; backgr
