<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/atom10full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><feed xmlns="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" gd:etag="W/&quot;D0MAQXw-eSp7ImA9WhRaFEw.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441</id><updated>2012-02-16T12:04:00.251-06:00</updated><category term="Tools" /><category term="TipsAndTricks" /><category term="Rhino.Mocks" /><category term="Code Analysis" /><category term="Networking" /><category term="UserGroups" /><title>Something To Read On The Train</title><subtitle type="html" /><link rel="http://schemas.google.com/g/2005#feed" type="application/atom+xml" href="http://wrightthisblog.blogspot.com/feeds/posts/default" /><link rel="alternate" type="text/html" href="http://wrightthisblog.blogspot.com/" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><generator version="7.00" uri="http://www.blogger.com">Blogger</generator><openSearch:totalResults>19</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/atom+xml" href="http://feeds.feedburner.com/WrightThisBlog" /><feedburner:info uri="wrightthisblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:feedFlare href="http://add.my.yahoo.com/rss?url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://us.i1.yimg.com/us.yimg.com/i/us/my/addtomyyahoo4.gif">Subscribe with My Yahoo!</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.newsgator.com/images/ngsub1.gif">Subscribe with NewsGator</feedburner:feedFlare><feedburner:feedFlare href="http://feeds.my.aol.com/add.jsp?url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://o.aolcdn.com/favorites.my.aol.com/webmaster/ffclient/webroot/locale/en-US/images/myAOLButtonSmall.gif">Subscribe with My AOL</feedburner:feedFlare><feedburner:feedFlare href="http://www.bloglines.com/sub/http://feeds.feedburner.com/WrightThisBlog" src="http://www.bloglines.com/images/sub_modern11.gif">Subscribe with Bloglines</feedburner:feedFlare><feedburner:feedFlare href="http://www.netvibes.com/subscribe.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.netvibes.com/img/add2netvibes.gif">Subscribe with Netvibes</feedburner:feedFlare><feedburner:feedFlare href="http://fusion.google.com/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://buttons.googlesyndication.com/fusion/add.gif">Subscribe with Google</feedburner:feedFlare><feedburner:feedFlare href="http://www.pageflakes.com/subscribe.aspx?url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.pageflakes.com/ImageFile.ashx?instanceId=Static_4&amp;fileName=ATP_blu_91x17.gif">Subscribe with Pageflakes</feedburner:feedFlare><feedburner:feedFlare href="http://www.plusmo.com/add?url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://plusmo.com/res/graphics/fbplusmo.gif">Subscribe with Plusmo</feedburner:feedFlare><feedburner:feedFlare href="http://www.thefreedictionary.com/_/hp/AddRSS.aspx?http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://img.tfd.com/hp/addToTheFreeDictionary.gif">Subscribe with The Free Dictionary</feedburner:feedFlare><feedburner:feedFlare href="http://www.bitty.com/manual/?contenttype=rssfeed&amp;contentvalue=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.bitty.com/img/bittychicklet_91x17.gif">Subscribe with Bitty Browser</feedburner:feedFlare><feedburner:feedFlare href="http://www.newsalloy.com/?rss=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.newsalloy.com/subrss3.gif">Subscribe with NewsAlloy</feedburner:feedFlare><feedburner:feedFlare href="http://www.live.com/?add=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://tkfiles.storage.msn.com/x1piYkpqHC_35nIp1gLE68-wvzLZO8iXl_JMledmJQXP-XTBOLfmQv4zhj4MhcWEJh_GtoBIiAl1Mjh-ndp9k47If7hTaFno0mxW9_i3p_5qQw">Subscribe with Live.com</feedburner:feedFlare><feedburner:feedFlare href="http://mix.excite.eu/add?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://image.excite.co.uk/mix/addtomix.gif">Subscribe with Excite MIX</feedburner:feedFlare><feedburner:feedFlare href="http://download.attensa.com/app/get_attensa.html?feedurl=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.attensa.com/blogs/attensa/WindowsLiveWriter/BadgeredintoBadges_10C02/attensa_feed_button5.gif">Subscribe with Attensa for Outlook</feedburner:feedFlare><feedburner:feedFlare href="http://www.webwag.com/wwgthis.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.webwag.com/images/wwgthis.gif">Subscribe with Webwag</feedburner:feedFlare><feedburner:feedFlare href="http://www.podcastready.com/oneclick_bookmark.php?url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.podcastready.com/images/podcastready_button.gif">Subscribe with Podcast Ready</feedburner:feedFlare><feedburner:feedFlare href="http://www.flurry.com/pushRssFeed.do?r=fb&amp;url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.flurry.com/images/flurry_rss_logo2.gif">Subscribe with Flurry</feedburner:feedFlare><feedburner:feedFlare href="http://www.wikio.com/subscribe?url=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.wikio.com/shared/img/add2wikio.gif">Subscribe with Wikio</feedburner:feedFlare><feedburner:feedFlare href="http://www.dailyrotation.com/index.php?feed=http%3A%2F%2Ffeeds.feedburner.com%2FWrightThisBlog" src="http://www.dailyrotation.com/rss-dr2.gif">Subscribe with Daily Rotation</feedburner:feedFlare><entry gd:etag="W/&quot;C0AAQng-fSp7ImA9WhRbEUQ.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-4040230158905474782</id><published>2012-02-01T22:27:00.001-06:00</published><updated>2012-02-02T08:09:03.655-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-02T08:09:03.655-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tools" /><category scheme="http://www.blogger.com/atom/ns#" term="TipsAndTricks" /><category scheme="http://www.blogger.com/atom/ns#" term="Code Analysis" /><title>NCrunch -- A cool TDD Visual Studio extension</title><content type="html">&lt;div class="gmail_quote"&gt;
&lt;div style="color: #262626; font-family: Arial,Helvetica,sans-serif; font-size: 12px; line-height: 1.3;"&gt;
&lt;div style="word-wrap: break-word;"&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 6mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;I've got another dev tool that I wanted to pass along:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 6mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;A few months ago,&lt;/span&gt;&lt;/span&gt; &lt;a href="https://twitter.com/%20/l%20!/jonskeet/status/117859920602349568" target="_blank"&gt;&lt;span style="color: blue; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;u&gt;Jon Skeet posted a tweet&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;about a new tool he was using called&lt;/span&gt;&lt;/span&gt; &lt;a href="http://www.ncrunch.net/" target="_blank"&gt;&lt;span style="color: blue; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;u&gt;NCrunch&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;. &amp;nbsp;Since then, I've been playing with the tool and working with the author to resolve some of the issues (&lt;/span&gt;&lt;/span&gt;&lt;a href="http://forum.ncrunch.net/yaf_postst86_Unable-to-enable-NCrunch-for-new-install.aspx" target="_blank"&gt;&lt;span style="color: blue; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;u&gt;here&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;and&lt;/span&gt;&lt;/span&gt; &lt;a href="http://forum.ncrunch.net/yaf_postst111_Issue-with-linking-to-libraries-which-aren-t-built-by-solution-and-aren-t-in-GAC.aspx" target="_blank"&gt;&lt;span style="color: blue; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;u&gt;here&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;) that were blocking it from working smoothly in the my environment. &amp;nbsp;I believe it's now to the point where my coworkers who wish to take advantage can do so and where I can promote it's use to the world.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 6mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;a href="http://3.bp.blogspot.com/-6VE9K0ZxvYE/TyoQY6QzveI/AAAAAAAAASo/y-w-FAxz6ic/s1600/2012-02-01_222553.jpg" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-6VE9K0ZxvYE/TyoQY6QzveI/AAAAAAAAASo/y-w-FAxz6ic/s1600/2012-02-01_222553.jpg" style="cursor: move;" /&gt;&lt;/a&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;NCrunch, at its core, is a TDD extension for Visual Studio. &amp;nbsp;It will run your unit tests in the background and provide *&lt;/span&gt;&lt;span style="font-size: 12pt;"&gt;&lt;b&gt;real-time&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: 12pt;"&gt;* unit test results (no need to even save your file – runs as you type) by way of color-coded dots to the left of each line of code. (Green = passing, red = failing, black = not covered). &amp;nbsp;It will provide details for exceptions that are thrown and many other cool features. &amp;nbsp;This will allow you to get immediate feedback if changes you are currently typing break/fix any unit tests.&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 6mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 6mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;There's a very good demo video on the&lt;/span&gt;&lt;/span&gt; &lt;a href="http://www.ncrunch.net/" target="_blank"&gt;&lt;span style="color: blue; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;u&gt;NCrunch homepage&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;(about 6 minutes long) that I think is worth watching to get a feel for what the tool can do.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 6mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;b&gt;&lt;u&gt;Key features (or at least "My favorites"):&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style="list-style-type: disc; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="color: #010101; font-family: Symbol; font-size: 12pt; margin-left: 26pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;Line-by-line, real-time status of unit test coverage&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="color: #010101; font-family: Symbol; font-size: 12pt; margin-left: 26pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;Context menu access to applicable unit test&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="color: #010101; font-family: Symbol; font-size: 12pt; margin-left: 26pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;Tool-tip/hover bubble with details on:&lt;/span&gt;&lt;/span&gt;&lt;ul style="list-style-type: circle; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="color: #010101; font-family: Courier New; font-size: 12pt; margin-left: 10pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;number of covering tests,&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="color: #010101; font-family: Courier New; font-size: 12pt; margin-left: 10pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;performance,&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="color: #010101; font-family: Courier New; font-size: 12pt; margin-left: 10pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;exception details/stack trace&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li style="color: #010101; font-family: Symbol; font-size: 12pt; margin-left: 26pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;Visual indicators for performance metrics (slow tests have yellow centers -- with transparency based on level of slowness)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="color: #010101; font-family: Symbol; font-size: 12pt; margin-left: 26pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;Quickly run covering tests,&lt;/span&gt;&lt;/span&gt; &lt;a href="http://blog.ncrunch.net/post/NCrunch-137b-Released!.aspx" target="_blank"&gt;&lt;span style="color: blue; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;u&gt;debug into a given line&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;li style="color: #010101; font-family: Symbol; font-size: 12pt; margin-left: 26pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;Ability to&lt;/span&gt;&lt;/span&gt; &lt;a href="http://wiki.ncrunch.net/performance-tuning.ashx" target="_blank"&gt;&lt;span style="color: blue; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;u&gt;configure how much CPU&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt; &lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;it will use.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="color: #010101; font-family: Symbol; font-size: 12pt; font-weight: Bold; margin-left: 26pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;a href="http://blog.ncrunch.net/post/The-Future-of-NCrunch.aspx" target="_blank"&gt;&lt;span style="color: blue; font-family: 'Times New Roman';"&gt;&lt;span style="color: blue; font-family: 'Times New Roman'; font-size: 12pt; font-weight: bold;"&gt;&lt;b&gt;&lt;u&gt;It's FREE!!&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 6mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span style="font-size: 12pt;"&gt;&lt;b&gt;&lt;u&gt;Cons:&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style="list-style-type: disc; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="color: #010101; font-family: Symbol; font-size: 12pt; margin-left: 23pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;Feature overlap with TestDriven.Net and ReSharper test runners (although, the need for those may go away if you use NCrunch)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;li style="color: #010101; font-family: Symbol; font-size: 12pt; margin-left: 23pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;Some rough edges still (see below), but the developer is very actively updating and fixing bugs, and very responsive to users on the forum, twitter, etc.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 0mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 6mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;&lt;b&gt;&lt;u&gt;There are a couple of things to note:&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 13mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;ul style="list-style-type: disc; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="color: #010101; font-family: Symbol; margin-left: 5pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;NCrunch does a lot of background compilation and running unit tests. It appears to be smart enough to only compile/run tests that are affected by changes you are making. In any case, if you have a slow machine, you may want to disable the automatic testing and run in manual mode. &amp;nbsp;I have a very beefy development box (8 cores, 8GB memory) and don't see any issues (I also run ReSharper with full solution analysis mode with no issues).&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div align="left"&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;ul style="list-style-type: disc; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="color: #010101; font-family: Symbol; margin-left: 5pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;NCrunch lets you designate which unit tests to run/ignore. &amp;nbsp;In our case, we have both unit tests and system tests (db dependent) in the same solution, so developers would want to enable the unit tests but ignore the system tests. &amp;nbsp;When you first enable NCrunch for a project it asks you if you want to ignore all tests – I'd suggest doing that and then using the Tests window (accessible from the NCrunch menu) to unignore the tests/assemblies you care about from the right-click context menu.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div align="left"&gt;
&amp;nbsp;&amp;nbsp;&lt;/div&gt;
&lt;ul style="list-style-type: disc; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="color: #010101; font-family: Symbol; margin-left: 5pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;NCrunch has the option of running tests linearly or in parallel. &amp;nbsp;&lt;strike&gt;If your&amp;nbsp;tests are written such that they do not have side effects and don't share singletons, etc., then you should be better off running in parallel. However, you run the risk of having tests interfere with each other. &amp;nbsp;For our code, we need to run the tests one at a time.&lt;/strike&gt;(Update 2012-2-2: per the comment from the author, each test is run in a separate process, so no memory/static property sharing, so little risk to run the tests in parallel.)&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div align="left" style="margin-bottom: 4.75mm; margin-left: 13mm; margin-right: 0mm; margin-top: 4.75mm; text-indent: 0mm;"&gt;
&lt;/div&gt;
&lt;ul style="list-style-type: disc; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="color: #010101; font-family: Symbol; margin-left: 5pt; margin-right: 0pt; padding-left: 0pt;"&gt; &lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="color: #010101; font-family: 'Times New Roman'; font-size: 12pt; font-weight: normal;"&gt;NCrunch compiles each project in an isolated, shadow-copied environment in the background. There are some cases, though, where the Visual Studio configurations are such that NCrunch doesn't automatically determine all of the referenced assemblies that need to be copied. In those cases, you can flip a configuration setting to have NCrunch copy the output folder over into the shadow environment. &amp;nbsp;This resolves the issue, but does have a performance impact. &amp;nbsp; This shows itself as an error in the NCrunch Tests window with the message "Cannot register assembly XXX or one of its dependencies. The system cannot find the file specified."&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 13mm; margin-right: 0mm; margin-top: 0mm; text-indent: 0mm;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 13mm; margin-right: 0mm; margin-top: 0mm; text-indent: 0mm;"&gt;
&lt;a href="http://4.bp.blogspot.com/-sMcPaE27Z30/TyoPAxCoLrI/AAAAAAAAASU/Q_jic62NKpI/s1600/b33d7431520bbe3e5c9db37b6353a011-719363.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5704388383856930482" src="http://4.bp.blogspot.com/-sMcPaE27Z30/TyoPAxCoLrI/AAAAAAAAASU/Q_jic62NKpI/s320/b33d7431520bbe3e5c9db37b6353a011-719363.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 13mm; margin-right: 0mm; margin-top: 0mm; text-indent: 0mm;"&gt;
&lt;span style="color: #010101; font-family: 'Times New Roman';"&gt;&lt;span style="font-size: 12pt;"&gt;To resolve this, you need to enable the "CopyReferencedAssembliesToWorkspace" option for the project by going to the NCrunch Visual Studio menu and choosing the Configuration option, selecting the project in the Configuration window and changing the property.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 13mm; margin-right: 0mm; margin-top: 0mm; text-indent: 0mm;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 13mm; margin-right: 0mm; margin-top: 0mm; text-indent: 0mm;"&gt;
&lt;a href="http://4.bp.blogspot.com/-_P7SgC2OaBE/TyoPBBmPQGI/AAAAAAAAASk/NftG4an639g/s1600/c4c850f1f7d942573669b8137d30c98b-720756.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5704388388301258850" src="http://4.bp.blogspot.com/-_P7SgC2OaBE/TyoPBBmPQGI/AAAAAAAAASk/NftG4an639g/s320/c4c850f1f7d942573669b8137d30c98b-720756.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-4040230158905474782?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RulVAEA0ztrS8cSQjTKPlGCDKCU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RulVAEA0ztrS8cSQjTKPlGCDKCU/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/RulVAEA0ztrS8cSQjTKPlGCDKCU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RulVAEA0ztrS8cSQjTKPlGCDKCU/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=OJ_z3d3ZvcM:7L9BiSnVnls:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=OJ_z3d3ZvcM:7L9BiSnVnls:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=OJ_z3d3ZvcM:7L9BiSnVnls:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=OJ_z3d3ZvcM:7L9BiSnVnls:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=OJ_z3d3ZvcM:7L9BiSnVnls:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=OJ_z3d3ZvcM:7L9BiSnVnls:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/OJ_z3d3ZvcM" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2012/02/ncrunch-cool-tdd-visual-studio.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/4040230158905474782?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/4040230158905474782?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/OJ_z3d3ZvcM/ncrunch-cool-tdd-visual-studio.html" title="NCrunch -- A cool TDD Visual Studio extension" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/-6VE9K0ZxvYE/TyoQY6QzveI/AAAAAAAAASo/y-w-FAxz6ic/s72-c/2012-02-01_222553.jpg" height="72" width="72" /><thr:total>2</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2012/02/ncrunch-cool-tdd-visual-studio.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0EAQHszcSp7ImA9WhRbFU4.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-4941465408004689260</id><published>2011-11-25T07:22:00.001-06:00</published><updated>2012-02-06T08:47:21.589-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-06T08:47:21.589-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Analysis" /><title>Setting up Sonar analysis for C# projects</title><content type="html">In an effort to better understand some of the problematic areas of the C# codebase I work on, I recently setup an instance of the &lt;a href="http://sonarsource.org/"&gt;Sonar code analysis platform&lt;/a&gt;. &amp;nbsp;Sonar is originally written for Java analysis and later added C# support. &amp;nbsp;This posting walks you through my experience attempting to setup, configure and run the analysis.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Sonar Overview:&lt;/b&gt;&lt;br /&gt;
So why did I even do this? &amp;nbsp;Once up and running, Sonar provides some useful metrics for pointing out hotspots in your code that may be making it more difficult to maintain and extend your functionality. Through the web interface, you can drill-down on any of the metrics to the module, class, and method level, including full source code. &amp;nbsp;Some of the metrics provided for each C# project include (screenshots are from the "nemo" demo site mentioned below, my own project, or other sources):&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-ozxcffSUuXM/Ts-hlWHxJkI/AAAAAAAAAQE/sPKtiWPK0aw/s1600/rules.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="88" src="http://2.bp.blogspot.com/-ozxcffSUuXM/Ts-hlWHxJkI/AAAAAAAAAQE/sPKtiWPK0aw/s320/rules.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;General analysis&amp;nbsp;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Uses several rule-based static analysis tools&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/FxCop"&gt;FxCop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/StyleCop"&gt;StyleCop&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.mono-project.com/Gendarme"&gt;Gendarme &lt;/a&gt;(part of the Mono project)&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Details and statistics, with drill-downs, on rule violations&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://2.bp.blogspot.com/-wa-6rm5-ZLY/Ts-hk60KLNI/AAAAAAAAAP0/KgKi3EtK2fg/s1600/complexity.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="108" src="http://2.bp.blogspot.com/-wa-6rm5-ZLY/Ts-hk60KLNI/AAAAAAAAAP0/KgKi3EtK2fg/s320/complexity.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://wrightthisblog.blogspot.com/2011/11/thoughts-on-cyclomatic-complexity.html"&gt;Cyclomatic Complexity&lt;/a&gt;&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;By method, class, file&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-Uq98TFPi7hw/Ts-gujf8TcI/AAAAAAAAAPk/pQ0S6O1dg1o/s1600/comment.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="102" src="http://4.bp.blogspot.com/-Uq98TFPi7hw/Ts-gujf8TcI/AAAAAAAAAPk/pQ0S6O1dg1o/s320/comment.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Comments:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Percentage of code commented&lt;/li&gt;
&lt;li&gt;Percentage of public APIs that are (un)documented&lt;/li&gt;
&lt;/ul&gt;
&lt;li&gt;Duplication:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Percentage of code that is duplicated&lt;/li&gt;
&lt;li&gt;Counts by duplicated lines of code, blocks, files&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-lAh2HbWC8T0/Ts-hlAVAziI/AAAAAAAAAP8/KcmtlCg7fvM/s1600/coverage.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="113" src="http://1.bp.blogspot.com/-lAh2HbWC8T0/Ts-hlAVAziI/AAAAAAAAAP8/KcmtlCg7fvM/s320/coverage.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Unit tests:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Coverage&lt;/li&gt;
&lt;li&gt;Success/Failure statistics&lt;/li&gt;
&lt;li&gt;Time to run&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-R7S0Bf43nvI/Ts-e4fxRNmI/AAAAAAAAAPc/sEIZeAS_QH0/s1600/counts.png" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" height="103" src="http://1.bp.blogspot.com/-R7S0Bf43nvI/Ts-e4fxRNmI/AAAAAAAAAPc/sEIZeAS_QH0/s320/counts.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Counts:&lt;/li&gt;
&lt;ul&gt;
&lt;li&gt;Lines of code&lt;/li&gt;
&lt;li&gt;Count of files&lt;/li&gt;
&lt;li&gt;Count of classes&lt;/li&gt;
&lt;li&gt;Count of methods&lt;/li&gt;
&lt;/ul&gt;
&lt;/ul&gt;
&lt;br /&gt;
In addition, it will track changes over time, so you can see where issues are increasing/decreasing in your code.&lt;br /&gt;
&lt;br /&gt;
Sonar is open sourced under the LGPL and free to use, however some of the plugins used to perform the analysis are only commercially available, and in some cases come with steep licencing fees. &amp;nbsp;For this blog, I focus on only freely available (ie: no fees) aspects of the product. Each of the tools I used are also freely available (FxCop, StyleCop, Gendarme, Gallio, PartCover, MySQL -- all have licenses that allow no-fee usage for most people).&lt;br /&gt;
&lt;br /&gt;
There is &lt;a href="http://nemo.sonarsource.org/"&gt;a demo site&lt;/a&gt; provided by one of the commericial plugin providers to demo the system (including their not-free SQALE plugin) which shows analysis for several opensource Java projects and can give you a feel for the UI and the data that can be provided. &amp;nbsp;Beware -- this includes data from some of the commercial plugins, so don't expect to see everything on that site after following this posting. &lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;General Sonar Technical Architecture:&lt;/b&gt;&lt;br /&gt;
Generally, the Sonar runner consumes the source code and analyzes it via plugins. &amp;nbsp;This information is published to the sonar database directly.&lt;br /&gt;
&lt;br /&gt;
The Sonar server pulls the results from the database and provides a UI for reviewing them.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 1: Prerequisites and Assumptions:&lt;/b&gt;&lt;br /&gt;
You'll need a 32-bit machine to run your analysis on. &amp;nbsp;There are issues with the 64-bit versions of Gallio and PartCover which caused errors. &amp;nbsp;If you must run on 64-bit, &lt;a href="http://docs.codehaus.org/display/SONAR/C-Sharp+Ecosystem+FAQ#C-SharpEcosystemFAQ-HowcanIrunGallioandPartCoverona64bitsWindows%3F"&gt;there are sites with workarounds&lt;/a&gt; to getting this running, but I didn't go that route because I needed a valid 64-bit build environment for my day-to-day tasks.&lt;br /&gt;
&lt;br /&gt;
In my case, I spun up a Windows 7 Virtual PC and installed everything on there, including my TeamCity build server.&lt;br /&gt;
&lt;br /&gt;
This posting assumes you have a working Debug build of your codebase that compiles with no errors and generates .pdb files. You need access to the source code and the output, as they exists at the completion of your build. &amp;nbsp;In my case, I have a CI server (&lt;a href="http://www.jetbrains.com/teamcity/"&gt;TeamCity&lt;/a&gt;&amp;nbsp;-- free for small/mid-scale configurations) running and just added another build step at the end to kick-off the Sonar analysis from the command line.&lt;br /&gt;
&lt;br /&gt;
You'll need to install the .Net Reference Assemblies, which are part of the &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=3138"&gt;Win7 SDK&lt;/a&gt;. &amp;nbsp;If you're using .Net 4, it seems the Reference Assemblies may only be available by installing Visual Studio 2010. &amp;nbsp;Note that the FxCop 10 installer is included (exclusively) with the Win7 SDK.&lt;br /&gt;
&lt;br /&gt;
If you have any Silverlight components in your build, you will need to install the &lt;a href="http://www.microsoft.com/download/en/details.aspx?id=7335"&gt;Silverlight SDK&lt;/a&gt; for the version of Silverlight you are targeting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 2: The Sonar Server&lt;/b&gt;&lt;br /&gt;
&lt;a href="http://www.sonarsource.org/downloads/"&gt;Download the Sonar server&lt;/a&gt;. At the time of this posting, it was version 2.11.&lt;br /&gt;
&lt;br /&gt;
This will give you a .zip file. &amp;nbsp;Decompress it into the location you want; I used C:/sonar-2.11&lt;br /&gt;
&lt;br /&gt;
You can find the official installation notes here:&amp;nbsp;&lt;a href="http://docs.codehaus.org/display/SONAR/Install+Sonar"&gt;http://docs.codehaus.org/display/SONAR/Install+Sonar&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
For the initial configuration/setup, I'd suggest running it at the command line until you know you have it fully configured. &amp;nbsp;To do that, open a command window and run &lt;code class="java plain" style="background-color: #eeeeee;"&gt;bin\windows-x86-32\StartSonar.bat&lt;/code&gt; This will run in your current window (no real output, but the command blocks) until you hit Cntl-Z or Cntl-Break.&lt;br /&gt;
&lt;br /&gt;
Again, I had trouble with the 64-bit version even running (no console output -- just died), so I'd stay with the 32-bit side.&lt;br /&gt;
&lt;br /&gt;
Once you get things working the way you want, I'd suggest installing it as a Windows service. &amp;nbsp;To do this, first register Sonar as a service using the provided script: &lt;code class="java plain" style="background-color: #eeeeee;"&gt;bin\windows-x86-32\InstallNTService.bat&lt;/code&gt; (There's an UnInstallNTService.bat script too). &amp;nbsp;Then, start the service from the Windows Services control panel, or using the provided "StartNTService.bat" script. &amp;nbsp;Personally, I would suggest just configuring it to be Automattic so it will service reboots, etc.&lt;br /&gt;
&lt;br /&gt;
The server has a &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.properties&lt;/span&gt; config file that drives some of it's functionality, including which database to use. You can find it in the \conf folder. &amp;nbsp;The only change I made to this file was for the database (see Step 2), but if you want to use the built-in Derby database, no changes are needed.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 2a: Verify and Change Password&lt;/b&gt;&lt;br /&gt;
At this point, you should be able to access the sonar server at http://localhost:9000 (or whatever port you set in the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.properties&lt;/span&gt; file). &lt;b&gt;I would highly recommend changing the admin password at this time.&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 3: The Database&lt;/b&gt;&lt;br /&gt;
Sonar server comes with a build-in Derby database. &amp;nbsp;While it is quick and easy (and pre-configured), I would suggest moving away from it almost immediately. &amp;nbsp;I had MAJOR performance problems using it. &amp;nbsp;For instance, for my solution of about 400K lines of code (50+ Visual Studio projects), when using the Derby database, it took about 2 hours to perform the analysis, 5 hours if the runner was on a differnt host. During that time, the server CPU would be pegged at 100% for 5 - 15 minutes per project as the runner reported it's results. &amp;nbsp;Once I moved to a MySQL database, it takes about 20 minutes.&lt;br /&gt;
&lt;br /&gt;
So, I would suggest downloading and installing the&lt;a href="http://www.mysql.com/products/community/"&gt; free MySQL Communit Edition &lt;/a&gt;from Oracle.&lt;br /&gt;
&lt;br /&gt;
Once installed, you'll need to create the sonar database instance. &amp;nbsp;This is pretty straightforward, but Sonar provides a script to make it even that much easier. &amp;nbsp;From the sonar installation folder, the script is in extras/database/mysql/create_database.sql. This will generate the sonar database instance, as well as grant access from localhost and remotely. &amp;nbsp;The sonar schema is created the first time you run the server.&lt;br /&gt;
&lt;br /&gt;
You'll need to configure the Sonar server to use this db. &amp;nbsp;This is as easy as changing a couple of lines in the &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.properties&lt;/span&gt; config file. Chances are, the lines you want are already in the file (commented out), as samples are there for MySQL, PostgreSQL, Oracle and MS SqlServer. (Note: MS SqlServer is not officially supported, although people on the web have &lt;a href="http://www.sezok.de/sonar/sonar.html"&gt;posted ways to get it working&lt;/a&gt;. I did not venture down this path).&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="background-color: #cccccc; font-family: Times, 'Times New Roman', serif;"&gt;&lt;b&gt;&lt;br class="Apple-interchange-newline" /&gt;Update:&lt;/b&gt;&amp;nbsp;While getting Sonar up and running in our production environment, the person doing the work was able to get up and running with MS SqlServer and provided me with this feedback. Note, he was using v.2.13.1, which is newer than what I was using:&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="background-color: #cccccc; font-family: Times, 'Times New Roman', serif;"&gt;I followed the link you had on your page (&lt;a href="http://www.sezok.de/sonar/sonar.html"&gt;http://www.sezok.de/sonar/sonar.html&lt;/a&gt;) but differed in the following ways:&lt;/span&gt;&lt;ul&gt;
&lt;li&gt;&lt;span style="background-color: #cccccc; text-indent: -0.25in;"&gt;&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;The database must be setup with Case Sensitive and Accent Sensitive rules, so I created the database with collate option SQL_Latin1_General_CP1_CS_AS&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="background-color: #cccccc; text-indent: -0.25in;"&gt;&lt;span style="font-family: Times, 'Times New Roman', serif;"&gt;The jdbc drivers that come bundled with 2.13.1 actually work, and the ones listed in the above link don’t.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/blockquote&gt;
&lt;br /&gt;
&lt;div class="MsoListParagraph" style="text-indent: -0.25in;"&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;div class="MsoListParagraph" style="text-indent: -0.25in;"&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
For me, I commented out the Derby lines and used these for my MySQL instance:

&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;#----- MySQL 5.x/6.x&lt;br /&gt;# Comment the embedded database and uncomment the following properties to use MySQL.&lt;br /&gt;# The validation query is optional.&lt;br /&gt;
sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;amp;characterEncoding=utf8&lt;br /&gt;sonar.jdbc.driverClassName: com.mysql.jdbc.Driver&lt;br /&gt;#sonar.jdbc.validationQuery: select 1&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
Restart the sonar server, if it's running.
&lt;br /&gt;
&lt;br /&gt;
I should note that there isn't a quick-and-easy way to migrate from the Derby db to another, so expect any data collected in Derby will be lost when you move. &amp;nbsp;I found&lt;a href="http://my.opera.com/Wutske/blog/2011/04/03/migrating-sonar-from-derby-to-mysql"&gt; this page&lt;/a&gt; where someone found a way, if you really must try.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Step 3a: Verify and Change password&lt;/b&gt;&lt;br /&gt;
At this point, the sonar server should be up and running, albeit with no data. &amp;nbsp;I would suggest verifying you can reach the server at http://localhost:9000 (or whatever port you used in the &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.properties&lt;/span&gt; file).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;&lt;u&gt;I would highly recommend changing the admin password at this time!&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 4: The Runner&lt;/b&gt;&lt;br /&gt;
Sonar was build for Java, so the docs almost all assume you're using Maven. &amp;nbsp;You may be able to get this working with nAnt, but there's an easier route. &amp;nbsp;A small, java-based runner has been created that can be kicked-off from the command line. This is what I used from within my TeamCity builds.&lt;br /&gt;
&lt;br /&gt;
To use this runner, you will need to do a few things:&lt;br /&gt;
1)&amp;nbsp;&lt;a href="http://docs.codehaus.org/display/SONAR/Analyse+with+a+simple+Java+Runner"&gt;Download the runner&lt;/a&gt;. This will come as a Zip file. Decompress it in an appropriate location. For me, I put it in C:/Sonar-2.11/runner&lt;br /&gt;
&lt;br /&gt;
2) Install the&lt;a href="http://www.oracle.com/technetwork/java/javase/downloads/jdk-7u1-download-513651.html"&gt; Java JDK&lt;/a&gt;. &amp;nbsp;Yes, the &lt;b&gt;*JDK*&lt;/b&gt;. It's big and ugly, I know. You're a .Net dev,&lt;i&gt; I know&lt;/i&gt;. Do it anyway.&lt;br /&gt;
&lt;br /&gt;
3) Set the&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; JAVA_HOME&lt;/span&gt; environment variable to point to the JDK root folder. &amp;nbsp;Make sure to set this environment var where the runner will get it. &amp;nbsp;Typically, I would say set it as a System ENV var, but in my case, there is a bug in the current TeamCity build agent that does not properly pass system env vars when running as a remote agent, so while running in that config, I had to use User vars and run the agent as my user. &amp;nbsp;If you're running this all on the same machine, you should be fine with a System Environment Var.&lt;br /&gt;
&lt;br /&gt;
4) Test that it works. &amp;nbsp;Open a command line to the sonar-runner/bin folder and run &lt;span style="background-color: #eeeeee;"&gt;&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar-runner -h&lt;/span&gt;&lt;/span&gt;. &amp;nbsp;This will either show you the usage statement (if things are working fine), or blow up. &amp;nbsp;If it blows up, check you're JAVA_HOME is set correctly.&lt;br /&gt;
&lt;br /&gt;
5) Once it works, set another environment var: &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;SONAR_RUNNER_HOME&lt;/span&gt; to the root installation folder for sonar-runner. This is used when you want to run the sonar runner from a folder other than the /bin folder. (ie: when you run sonar-runner from your source folder).&lt;br /&gt;
&lt;br /&gt;
6) Change the &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;conf/sonar-runner.properties&lt;/span&gt; file. This has general configuration items used by the runner, some of which can be overridden in the project's config file (we'll get to that later). &amp;nbsp;At a minimum, you'll need to set the&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; sonar.host.url&lt;/span&gt; to point to where you have your sonar server running, and the database config. &amp;nbsp;For the db, just copy/paste the lines from the&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; sonar.properties&lt;/span&gt; file you created in Step 2. Again, example values are provided in the file (commented out) which will likely work just fine. Don't forget to comment out the Derby lines.
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 5: The C# Plugins&lt;/b&gt;&lt;br /&gt;
You'll need to install the "&lt;a href="http://docs.codehaus.org/display/SONAR/C-Sharp+Plugins+Ecosystem"&gt;C# Plugins Ecosystem&lt;/a&gt;" (ie: The plugins to analyze C# code). &amp;nbsp;This will be a zip file with each of the C# plugins .jar files. Decompress them and place them into the /extentions/plugins folder of your Sonar installation folder. &amp;nbsp;You can enable/disable each one individually, so no harm in putting them all in there at once.&lt;br /&gt;
&lt;br /&gt;
The plugins consist of the following:&lt;br /&gt;
&lt;ul&gt;
&lt;li&gt;C# Core (support for the C# language - general API used by other plugins -- required)&lt;/li&gt;
&lt;li&gt;C# Squid (support for parsing C# language -- required)&lt;/li&gt;
&lt;li&gt;FxCop support (general analysis)&lt;/li&gt;
&lt;li&gt;StyleCop support (formatting analysis)&lt;/li&gt;
&lt;li&gt;Gendarme support (general analysis)&lt;/li&gt;
&lt;li&gt;Gallio support (unit testing / coverage)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
If you're going to use FxCop, you'll need to install FxCop 10 (&lt;a href="http://blogs.msdn.com/b/codeanalysis/archive/2010/07/26/fxcop-10-0-is-available.aspx"&gt;the FxCop installer is installed as part of the Win7 SDK install&lt;/a&gt;).&lt;br /&gt;
&lt;br /&gt;
If you're going to use StyleCop, you can either use a bundled version included with Sonar, or install you're own.&lt;br /&gt;
&lt;br /&gt;
If you're going to use Gendarme, I've found that the version bundled with Sonar &lt;a href="http://stackoverflow.com/questions/6590348/could-not-load-file-or-assembly-from-satelliteresourcemismatchrule"&gt;has a bug in it &lt;/a&gt;that caused it to error if you referenced System.Drawing from the .Net 4.0 library. &amp;nbsp;I had to install the &lt;a href="https://github.com/spouliot/gendarme/downloads"&gt;newest version&lt;/a&gt; (2.11 snapshot).&lt;br /&gt;
&lt;br /&gt;
If you're going to use Gallio, you'll need to&lt;a href="http://www.gallio.org/Downloads.aspx"&gt; install it&lt;/a&gt;&amp;nbsp;as well as &lt;a href="http://sourceforge.net/projects/partcover/"&gt;PartCover&amp;nbsp;&lt;/a&gt;(or you can use NCover, if you have a license).&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 6: The sonar-project.properties File&lt;/b&gt;&lt;br /&gt;
Each Solution will need to have it's own&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt; sonar-project.properties&lt;/span&gt; file. &amp;nbsp;This file will need to exist in the folder from which you execute the sonar-runner. &amp;nbsp;To make this easy, I would suggest putting the file in the same folder as your .sln file.&lt;br /&gt;
&lt;br /&gt;
The file will have a few sections, which I will describe here. Note that some of these, I believe, can be put in the &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar-runner.properties&lt;/span&gt; file if you have the same settings for each project.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Important Note:&lt;/b&gt;&amp;nbsp;Any folder names in the config file will need to either escape the backslash with another backslash (\\) or use a forward slash (/). I've chosen the latter.&lt;br /&gt;
&lt;br /&gt;
&lt;u&gt;Project Identification:&lt;/u&gt;&lt;br /&gt;
This section will provide the project key used by the Sonar server to group analysis results over time, as well as provide a useful name in the UI, etc. &amp;nbsp;This should be unique across projects. &amp;nbsp;The project version can be used to track different branches, etc.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;# Project identification&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.projectKey=Jwright:DemoApp&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.projectVersion=trunk&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.projectName=DemoApplication&lt;/span&gt;&lt;/blockquote&gt;
Then, describe the source code layout. The "sources" field points to the top-level folder where the source code exists. &amp;nbsp;If you're .sln and .csproj files have relative paths internally, then this should be the top-level folder. &amp;nbsp;Assuming you don't have any strange layouts, this will likely be the same folder as your .sln file (which is likely where your .properties file exists), so can just be ".". &amp;nbsp;Additionally, you need to denote that the language is C# using the "cs" value.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;# Info required for Sonar &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sources=.&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.language=cs &amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;u&gt;C#-specific settings:&lt;/u&gt;&lt;br /&gt;
Here, you'll need to provide information about where the .sln file is located and where key libraries are located, and which version of .Net you're using.&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;#Core C# Settings &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.dotnet.visualstudio.solution.file=DemoApp.sln&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.silverlight.4.mscorlib.location=C:/Program&amp;nbsp;Files/Reference&amp;nbsp;Assemblies/Microsoft/Framework/Silverlight/v4.0&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.dotnet.excludeGeneratedCode=true&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.dotnet.4.0.sdk.directory=C:/WIndows/Microsoft.NET/Framework/v4.0.30319&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.dotnet.version=4.0&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;u&gt;Plug-in Specific Sections:&lt;/u&gt;&lt;br /&gt;
For each plugin, there is a "mode" setting. &amp;nbsp;If blank, then the plugin will run. If you want to skip/not run a plugin, set the mode to "skip".&lt;br /&gt;
&lt;br /&gt;
For Gallio, you can stipulate if you want to use PartCover (free) or NCover (not free). You can also stipulate the runner mode. &amp;nbsp;I had trouble using anything other than "Local". &amp;nbsp;You will also need to stipulate the naming pattern (regular expressions, I believe) for the Visual Studio projects that include unit tests. You can have multiple patterns, seperated by semicolons.&lt;br /&gt;
&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;
&lt;b&gt;Very Important:&lt;/b&gt;&amp;nbsp;Note that there is a bug/typo in the Gallio plugin where the key for the Test Project Pattern does &lt;u style="font-weight: bold;"&gt;not&lt;/u&gt;&amp;nbsp;have a "t" in "sonar.&lt;b&gt;donet&lt;/b&gt;.visualstudio.testProjectPattern". &amp;nbsp;You'll also need to provide the installation directory for PartCover.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;#Gendarme&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.gendarme.mode=&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;# Gallio &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.gallio.mode=&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.gallio.coverage.tool=PartCover&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.gallio.runner=Local&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.donet.visualstudio.testProjectPattern=*UnitTest*;Testing*&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.partcover.installDirectory=C:/Program&amp;nbsp;Files/PartCover/PartCover&amp;nbsp;.NET 4.0/&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;# FXCop &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.fxcop.mode= &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/blockquote&gt;
&lt;blockquote class="tr_bq"&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;#StyleCop &lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.stylecop.mode=&lt;/span&gt;&lt;/blockquote&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Step 7: Running an Analysis&lt;/b&gt;&lt;br /&gt;
From the folder with the sonar-project.properties file, run the command&lt;br /&gt;
$SONAR_RUNNER_HOME/bin/sonar-runner&lt;br /&gt;
&lt;br /&gt;
You'll see the runner start up, listing some details like the working folder, etc, then it will kick off the source code parsing, then the plugins (such as running the unit tests). &amp;nbsp;If there are any errors, a Java exception will be thrown. Sometimes these contain enough details to troubleshoot, sometimes not, so you may need to run with the -X command line argument to get additional details when errors occur.&lt;br /&gt;
&lt;br /&gt;
After a successful run of the analysis, you can see the results in the sonar server webpage. Unless you have changed the port in the &lt;span style="font-family: 'Courier New', Courier, monospace;"&gt;sonar.properties&lt;/span&gt; file, this will be at http://localhost:9000/&lt;br /&gt;
&lt;br /&gt;
The homepage will have a link for each project (the value provided as sonar.projectName), which will take you to the project overview. &amp;nbsp;Clicking on any of the links on the overview page will take you to the drill-down data for that metric.&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;References:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
I used this page to start my journey, in addition to the Sonar project docs:&amp;nbsp;&lt;a href="http://www.ifunky.net/Blog/post/Install-and-Configure-Sonar-on-Windows-2008.aspx"&gt;http://www.ifunky.net/Blog/post/Install-and-Configure-Sonar-on-Windows-2008.aspx&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The C# Plugins page:&amp;nbsp;&lt;a href="http://docs.codehaus.org/display/SONAR/C-Sharp+Plugins+Ecosystem"&gt;http://docs.codehaus.org/display/SONAR/C-Sharp+Plugins+Ecosystem&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
The Sonar installation page:&amp;nbsp;&lt;a href="http://docs.codehaus.org/display/SONAR/Install+Sonar"&gt;http://docs.codehaus.org/display/SONAR/Install+Sonar&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Update:&lt;/b&gt;&lt;br /&gt;
The Sonar Source page, complete with mailing lists, issue trackers, etc. &lt;a href="http://www.sonarsource.org/support/support"&gt;http://www.sonarsource.org/support/support&amp;nbsp;&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Hope this helps!&lt;br /&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-4941465408004689260?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/q1cfast6Ult_pBv7zjKhnf0uo0U/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/q1cfast6Ult_pBv7zjKhnf0uo0U/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/q1cfast6Ult_pBv7zjKhnf0uo0U/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/q1cfast6Ult_pBv7zjKhnf0uo0U/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=XJ6aaPfv3yk:8FybuM-k9VM:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=XJ6aaPfv3yk:8FybuM-k9VM:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=XJ6aaPfv3yk:8FybuM-k9VM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=XJ6aaPfv3yk:8FybuM-k9VM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=XJ6aaPfv3yk:8FybuM-k9VM:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=XJ6aaPfv3yk:8FybuM-k9VM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/XJ6aaPfv3yk" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2011/11/setting-up-sonar-analysis-for-c.html#comment-form" title="3 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/4941465408004689260?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/4941465408004689260?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/XJ6aaPfv3yk/setting-up-sonar-analysis-for-c.html" title="Setting up Sonar analysis for C# projects" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://2.bp.blogspot.com/-ozxcffSUuXM/Ts-hlWHxJkI/AAAAAAAAAQE/sPKtiWPK0aw/s72-c/rules.png" height="72" width="72" /><thr:total>3</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2011/11/setting-up-sonar-analysis-for-c.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0YAQXk4fip7ImA9WhRRFE8.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-5073621557662392460</id><published>2011-11-10T16:44:00.001-06:00</published><updated>2011-11-27T14:19:00.736-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-11-27T14:19:00.736-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Code Analysis" /><title>Thoughts on Cyclomatic Complexity</title><content type="html">&lt;br /&gt;
&lt;div align="left"&gt;
&lt;span style="-webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; border-collapse: separate; font-family: Tahoma; text-align: -webkit-auto;"&gt;&lt;span style="color: #262626; font-family: Arial;"&gt;&lt;span style="font-size: 12px;"&gt;The following is an excerpt from an email/blog I wrote for internal consumption by my development team, but I think the concepts are universal and worth sharing. I've removed any specific references to company intellectual property and otherwise "sanitized" the details, so some of the details are lost in the process.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial;"&gt;&lt;span style="font-size: 12px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;For those unfamiliar with the term, Cyclomatic Complexity is a formula for determining the varying logical paths that can be taken though a piece of code, thus determining a quantitative value for the code's complexity. A higher Cyclomatic Complexity score means that there are a lot of code paths and/or factors that affect the logic with the code. One way to think about it is this: to fully unit test a method, you should have one unit test for each logic path - thus a score of 10 would result in as many unit tests.&amp;nbsp; Wikipedia entry:&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity"&gt;&lt;span style="color: blue; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;u&gt;http://en.wikipedia.org/wiki/Cyclomatic_complexity&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;The higher the CC score, the more difficult a piece of code is to read and understand, to test, and therefore, riskier to modify and maintain over time. A general rule-of-thumb suggests keeping the CC score to under 15 greatly improves readability, maintainability and reduces defects in the code.&amp;nbsp; Anything above that, and the code is likely violating the single responsibility principle and is trying to do too much.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 0mm; margin-right: 0mm; margin-top: 8.44mm; text-indent: 0mm;"&gt;
&lt;span style="color: #365f91; font-family: Cambria; font-size: medium;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;b&gt;So why do I bring this up?&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Because&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #262626; font-family: Arial; font-size: 12px;"&gt;over the last 9 months as I've been learning the company's codebase and delving into many areas of code where I have no prior knowledge, I've come across sections of code which have been difficult to pick up and understand, and/or which requires and extraordinary amount of knowledge about the inner workings of that code and the code around it (tight coupling). And, as a direct corollary, this code is has low (or no) unit test coverage to protect us against mistakes and misunderstandings.&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 0mm; margin-right: 0mm; margin-top: 8.44mm; text-indent: 0mm;"&gt;
&lt;span style="color: #365f91; font-family: Cambria; font-size: medium;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;b&gt;From theory to concrete examples:&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;A little further down, I will discuss how I suggest we address this issue, but first I want to give some concrete examples of what I'm talking about.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial;"&gt;&lt;span style="font-size: 12px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;I was recently tasked with making a fairly straightforward change to what data is displayed in one of our "legacy" controls; however, it took me almost a full day just to wrap my head around what the control was doing and all of the (inconsistent) ways other classes/controls interacted with it.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial;"&gt;&lt;span style="font-size: 12px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Method:&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;private&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;void&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;SelectAll(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;SelectAllMode&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;mode)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Cyclomatic Complexity: 23&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;So what&amp;nbsp;makes this method particularly problematic? &amp;nbsp;Nested conditionals.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;At one point, there's:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;ul style="margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="color: #262626; font-family: Symbol; margin-left: 5pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="font-family: Tahoma; font-size: xx-small;"&gt;&lt;span style="color: black; font-size: 9pt;"&gt;an if block,&lt;/span&gt;&lt;/span&gt;&lt;ul style="margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="font-family: 'Courier New'; margin-left: 10pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;with a nested if block&lt;/span&gt;&lt;/span&gt;&lt;ul style="margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="font-family: Wingdings; margin-left: 10pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;with a nested if block&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;ul style="list-style-type: disc; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="margin-left: 10pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;with a nested foreach loop&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;ul style="list-style-type: circle; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="margin-left: 10pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;with a nested if block&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;ul style="margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="margin-left: 10pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;with a nested switch block&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;ul style="list-style-type: disc; margin-bottom: 0mm; margin-top: 0mm;"&gt;
&lt;li style="margin-left: 10pt; margin-right: 0pt; padding-left: 0pt;"&gt;&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;with a nested if block.&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;There are 11 if statements and 3 switch statements in a 96-line method -- 66 lines, if you don't count non-code lines.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Method:&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;public&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;void&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Initialize()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;Cyclomatic Complexity: 17&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;This method does not have the level of conditionals of SelectAll(), but it does change behavior based on the type of a public property. In this case, the control accepts four types of DataSets (we utilize typed DataSets, which extend the DataSet class -- so there's a ProductDataSet, PricingPlanDataSet, etc) and acts differently based on the type of the dataset.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Another factor that affects code complexity is high levels of coupling with other classes, and in this case the Initalize() method is coupled with 36 other classes. This means that there is an increased potential that changes in those other classes will affect the logic in this method.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 0mm; margin-right: 0mm; margin-top: 8.44mm; text-indent: 0mm;"&gt;
&lt;span style="color: #365f91; font-family: Cambria; font-size: medium;"&gt;&lt;span style="font-size: 14pt;"&gt;&lt;b&gt;So, what can we, as developers, do?&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;b&gt;&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;b&gt;&lt;u&gt;Step 1: Knowing you have a problem&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Aside from just generally being aware of&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;a href="http://www.codinghorror.com/blog/2006/05/code-smells.html"&gt;&lt;span style="color: blue; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;u&gt;Code Smells&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&amp;nbsp;&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;(&lt;/span&gt;&lt;/span&gt;&lt;a href="http://www.codinghorror.com/blog/2006/05/code-smells.html"&gt;&lt;span style="color: blue; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;u&gt;http://www.codinghorror.com/blog/2006/05/code-smells.html&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;) when you see them, there are a couple of tools that will help specifically call out Cyclomatic Complexity:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;There is a free "CyclomaticComplexity PowerToy" ReSharper plugin that will mark any methods with a CC score above 17 with a ReSharper warning and display the CC score as a tooltip. It can be downloaded here:&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;a href="http://resharperpowertoys.codeplex.com/"&gt;&lt;span style="color: blue; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;u&gt;http://resharperpowertoys.codeplex.com/&lt;/u&gt;&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;(make sure to grab the v5.1 installer pack if you haven't upgraded from v5 -- the source code is already converted to use ReSharper v6). This will give you more "real time" warnings that things are ugly.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://1.bp.blogspot.com/-MPFhMoYzvGQ/TrxVMAhv7eI/AAAAAAAAAPM/ni73-BqlNZU/s1600/Image1.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="86" src="http://1.bp.blogspot.com/-MPFhMoYzvGQ/TrxVMAhv7eI/AAAAAAAAAPM/ni73-BqlNZU/s320/Image1.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 25mm; margin-right: 0mm; margin-top: 0mm; text-indent: 0mm;"&gt;
&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Additionally, Visual Studio 2010 Ultimate comes with code analytics features which will calculate several metrics for your code, including Cyclomatic Complexity, Depth of Inheritance, Class Coupling, Lines of Code, and something Microsoft calls a "Maintainability Index", where they try to apply an aggregation of the others to give you an overall score.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;You can access this feature from the Analyze menu&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/-6oxIGVjq2nU/TrxU3eHspvI/AAAAAAAAAPE/a_bOoxR9_4E/s1600/2.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="143" src="http://3.bp.blogspot.com/-6oxIGVjq2nU/TrxU3eHspvI/AAAAAAAAAPE/a_bOoxR9_4E/s320/2.jpg" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 38mm; margin-right: 0mm; margin-top: 0mm; text-indent: 0mm;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;This can be quite time consuming, though, depending on your hardware and the size of the Solution/Project you decide to analyze.&amp;nbsp; At the end, VS2010 will spit out a report, which can be exported to Excel.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 13mm; margin-right: 0mm; margin-top: 0mm; text-indent: 0mm;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div align="left" style="margin-bottom: 0mm; margin-left: 13mm; margin-right: 0mm; margin-top: 0mm; text-indent: 0mm;"&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://4.bp.blogspot.com/-DoEpEuNRoPo/TrxUXy2nS0I/AAAAAAAAAO0/c2MLKvB8C4Y/s1600/Image3.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="127" src="http://4.bp.blogspot.com/-DoEpEuNRoPo/TrxUXy2nS0I/AAAAAAAAAO0/c2MLKvB8C4Y/s320/Image3.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;b&gt;&lt;u&gt;Step 2: Refactor to reduce complexity, improve understanding&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;I am a firm believer in a phase I picked up from Martin Fowler's writings (which he attributes to "Uncle Bob" Martin):&lt;/span&gt;&amp;nbsp;&lt;span style="font-size: 9pt;"&gt;&lt;b&gt;&lt;i&gt;"always leave the code behind in a better state than you found it".&lt;/i&gt;&lt;/b&gt;&lt;/span&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp; For me, this means small refactorings to address issues or improve understanding of the code.&amp;nbsp; For example, if you're coming in to a piece of code and it takes you more than two minutes to figure out what the code is trying to do, you should look for ways to make the code more clear and embed the understanding you just gained into the code.&amp;nbsp; Maybe that means pulling a set of lines out into their own method and naming that method in a way that makes it clear what those lines are doing. In other cases, it may be a larger refactoring effort.&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;The key here is make it better than you found it -- it doesn't have to be perfect.&amp;nbsp; If everyone who touched the code makes it better each time, then those areas of the code that get touched a lot improve quickly -- which is good, because areas that change a lot are the places that have the most risk of getting broken.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;So in my examples above, I would apply this rule in two ways:&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;1) pull out those nested conditionals in SelectAll() into sub-methods (assuming there isn't a clear way to remove them altogether)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;2) utilize inheritance to reduce conditional blocks, such as those in Initialize().&amp;nbsp; By having the core/shared functionality in a base class, then having derived classes for each of the DataSet types, we could move the type-specific code into easier-to-maintain and smaller classes and greatly improve the readability and maintainability of the code.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Now, obviously I didn't do these things, otherwise they wouldn't still be here as examples.&amp;nbsp; Why not? Well, because this class is tied to core functionality in our system and zero unit tests, so we would need considerable QA effort to regression test this functionality -- and had no QA resources available to do that.&amp;nbsp; So from a risk standpoint, this was not the time to make changes.&amp;nbsp; However, I do hope we can get scheduled time in the (near) future to do planned refactoring of this code.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;b&gt;&lt;u&gt;Step 3: Don't make things worse&lt;/u&gt;&lt;/b&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #262626; font-family: Arial; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;This one's easy: When writing new code, make sure it's clean, readable and testable.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-5073621557662392460?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/g_SpyI6TyK97NvnNGza7lWidM_g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/g_SpyI6TyK97NvnNGza7lWidM_g/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/g_SpyI6TyK97NvnNGza7lWidM_g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/g_SpyI6TyK97NvnNGza7lWidM_g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Zm5o7MDr--k:GEpddKNQLrU:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=Zm5o7MDr--k:GEpddKNQLrU:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Zm5o7MDr--k:GEpddKNQLrU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Zm5o7MDr--k:GEpddKNQLrU:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Zm5o7MDr--k:GEpddKNQLrU:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Zm5o7MDr--k:GEpddKNQLrU:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/Zm5o7MDr--k" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2011/11/thoughts-on-cyclomatic-complexity.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/5073621557662392460?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/5073621557662392460?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/Zm5o7MDr--k/thoughts-on-cyclomatic-complexity.html" title="Thoughts on Cyclomatic Complexity" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://1.bp.blogspot.com/-MPFhMoYzvGQ/TrxVMAhv7eI/AAAAAAAAAPM/ni73-BqlNZU/s72-c/Image1.jpg" height="72" width="72" /><thr:total>1</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2011/11/thoughts-on-cyclomatic-complexity.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A0UGQXkyeSp7ImA9WhdaEkw.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-5431711724243789928</id><published>2011-08-16T07:22:00.000-05:00</published><updated>2011-10-21T12:47:00.791-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-10-21T12:47:00.791-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TipsAndTricks" /><title>Filtering DataTable with LINQ</title><content type="html">&lt;div&gt;
&lt;/div&gt;
&lt;div&gt;
I had a situation today where I needed to modify an existing method that fetched a DataTable &amp;nbsp;from the Data Access Layer, modified and returned it as a DataView. &amp;nbsp;My task was to filter the rows in the DataTable based on a call into managed code (ie: not something that could be done at the db level). &amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Now, I'm somewhat new to DataTables, having used ORMs for most of my .Net experience, so this was actually more difficult than I initially expected. &amp;nbsp;I was hoping to just set a value in RowFilter and be done. Unfortunately, as best I can tell, RowFilter does not allow row-specific dynamic filters (ie: you cannot call into a method with each row). &amp;nbsp;Furthermore, the return value of the method needed to stay as a DataView, since I'm tasked next with backporting &amp;nbsp;the change to our production branch and need to greatly limit the scope of my changes.&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
So after some googling, I was able to craft a solution using LINQ, which I wanted to document here for future reference. &amp;nbsp;Obviously, the code has been changed to protect the guilty, which has the side effect of greatly simplifying the logic.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div class="ennote"&gt;
&lt;div&gt;
I needed to reference System.Data.DataSetExtentions to have access to the DataTable LINQ extensions.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Then I did this:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span class="Apple-style-span"&gt;&lt;span class="Apple-style-span" style="color: #010101; font-family: Consolas; font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span class="Apple-style-span" style="color: blue;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; public&lt;/span&gt;&amp;nbsp;&lt;span class="Apple-style-span" style="color: #2b91af;"&gt;abstract&lt;/span&gt;&amp;nbsp;&lt;span class="Apple-style-span" style="color: #2b91af;"&gt;bool&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;span class="Apple-style-span"&gt;SecretFilteringMethod&lt;/span&gt;(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;int&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;someId);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;div align="left"&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;public&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;DataView&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;RetrieveFilteredRecords(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;int&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;someId)&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;DataSet&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;ds = DALServiceProxy.RetrieveRecords(someId);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span class="Apple-style-span"&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; DataTable myTable = ds.Tables[0&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: green; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;// this is bound to a UI drop-list, so add some usability enhancing rows&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ds.SuspendColumnValidation();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;DataRow&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;row1 =&amp;nbsp;&lt;span class="Apple-style-span"&gt;myTable&lt;/span&gt;.NewRow();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row1[&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;span class="Apple-style-span" style="color: #2b91af;"&gt;Consts&lt;/span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Columns&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;.Name] =&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #a31515; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;"-- Select One --"&lt;span class="Apple-style-span" style="color: #010101;"&gt;;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; row1[&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;span class="Apple-style-span" style="color: #2b91af;"&gt;Consts&lt;/span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Columns&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;.ID] = -1;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;span class="Apple-style-span"&gt;myTable&lt;/span&gt;.Rows.InsertAt(row1, 0);&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ds.ResumeColumnValidation();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span class="Apple-style-span" style="color: #010101; font-family: Consolas; font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span class="Apple-style-span" style="color: green;"&gt;&lt;span class="Apple-style-span"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// unlike most LINQ methods, this returns an EnumerableRowCollection&amp;lt;T&amp;gt; instead of IEnumerable&amp;lt;T&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;var&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;rowsAfterManagedCodeFiltering =&amp;nbsp;&lt;span class="Apple-style-span"&gt;myTable&lt;/span&gt;.AsEnumerable()&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Where(dpRow =&amp;gt; !dpRow.IsNull(&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;span class="Apple-style-span" style="color: #2b91af;"&gt;Consts&lt;/span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Columns&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;.ImportantField))&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; .Where(dpRow =&amp;gt;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span class="Apple-style-span" style="color: #2b91af;"&gt;SecretFilteringMethod&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;((&lt;/span&gt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;int&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;)dpRow[&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;span class="Apple-style-span" style="color: #2b91af;"&gt;Consts&lt;/span&gt;.&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;Columns&lt;/span&gt;&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;.&lt;span class="Apple-style-span"&gt;&amp;nbsp;ImportantField&lt;/span&gt;]));&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: blue; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;return&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&lt;span class="Apple-style-span"&gt;rowsAfterManagedCodeFiltering&lt;/span&gt;.AsDataView();&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: xx-small;"&gt;&lt;span style="font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div align="left"&gt;
&lt;span class="Apple-style-span" style="color: blue; font-family: Consolas; font-size: medium;"&gt;&lt;span class="Apple-style-span" style="font-size: 15px;"&gt;&lt;span class="Apple-style-span" style="color: #010101;"&gt;&lt;span class="Apple-style-span"&gt;&lt;br /&gt;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
The return value of AsDataView() is a LinqDataView object, which has its Table property set to the original DataTable, so the result is fairly close to what would happen if I'd set a RowFilter. However, instead of RowFilter, the RowPredicate property is set with the LINQ representation.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
One thing to note: RowPredicate and RowFilter are mutually exclusive, so if a consumer later tries to set RowFilter to further refine the view, it will erase the RowPredicate, thus falling back to the base DataTable's full set of records.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
Personally, I'd rather move away from the DataTable altogether and return an IEnumerable&amp;lt;T&amp;gt;, but that wasn't really a logistical option at this point.&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
Additionally, if you have an EnumerableRowCollection&amp;lt;T&amp;gt;, you can create a new DataTable with only the rows in the collection with the .CopyToDataTable()&amp;nbsp;extension&amp;nbsp;method.&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
References:&lt;/div&gt;
&lt;div&gt;
LINQ query on a DataTable:&amp;nbsp;&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://stackoverflow.com/questions/10855/linq-query-on-a-datatable" target=""&gt;&lt;/a&gt;&lt;a href="http://stackoverflow.com/questions/10855/linq-query-on-a-datatable"&gt;http://stackoverflow.com/questions/10855/linq-query-on-a-datatable&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
DataTableExtensions.AsDataView&amp;lt;T&amp;gt;:&lt;/div&gt;
&lt;div&gt;
&lt;a href="http://msdn.microsoft.com/en-us/library/bb908061.aspx" target=""&gt;&lt;/a&gt;&lt;a href="http://msdn.microsoft.com/en-us/library/bb908061.aspx"&gt;http://msdn.microsoft.com/en-us/library/bb908061.aspx&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-5431711724243789928?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/o0HjQE6BaJYKly4mPJitVaihwCw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/o0HjQE6BaJYKly4mPJitVaihwCw/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/o0HjQE6BaJYKly4mPJitVaihwCw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/o0HjQE6BaJYKly4mPJitVaihwCw/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oUc4SGburac:Ly00fFki5KM:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=oUc4SGburac:Ly00fFki5KM:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oUc4SGburac:Ly00fFki5KM:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oUc4SGburac:Ly00fFki5KM:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oUc4SGburac:Ly00fFki5KM:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oUc4SGburac:Ly00fFki5KM:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/oUc4SGburac" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2011/08/filtering-datatable-with-linq.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/5431711724243789928?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/5431711724243789928?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/oUc4SGburac/filtering-datatable-with-linq.html" title="Filtering DataTable with LINQ" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2011/08/filtering-datatable-with-linq.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEYFR3s9eyp7ImA9WhdVEUU.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-2393542719459640970</id><published>2011-06-21T09:17:00.001-05:00</published><updated>2011-09-16T09:08:36.563-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-09-16T09:08:36.563-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Rhino.Mocks" /><category scheme="http://www.blogger.com/atom/ns#" term="TipsAndTricks" /><title>On Rhino.Mocks VerifyAllExpectations Vs AssertWasCalled</title><content type="html">&lt;div&gt;
&lt;div style="background-color: rgba(0, 0, 0, 0); margin-bottom: 12px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;"&gt;
&lt;span class="Apple-style-span" style="color: #333333; font-family: Georgia, Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="line-height: 24px;"&gt;After reading my   &lt;/span&gt;&lt;/span&gt;&lt;a href="http://wrightthisblog.blogspot.com/2011/03/using-rhinomocks-quick-guide-to.html" style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px;" title="wrightthisblog.blogspot.com"&gt;Rhino.Mocks Quick&amp;nbsp;Reference&lt;span class="Apple-style-span" style="color: #333333; font-family: Georgia, Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="line-height: 24px;"&gt;&amp;nbsp;post&lt;/span&gt;&lt;/span&gt;&lt;/a&gt;&lt;span class="Apple-style-span" style="color: #333333; font-family: Georgia, Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="line-height: 24px;"&gt;, a colleague and I had a discussion about the proper way to validate expectations in Rhino.Mocks. Specifically, he questioned if my use of .VerifyAllExceptions() was correct for the ArrangeActAssert syntax, or, as he proposed, is it the "old" syntax, being replaced by the .AssertWasCalled() methods. &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: normal; line-height: 24px; margin-bottom: 12px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;
Since this is a person I respect, I decided not to smite him and instead took a mental note to do some &lt;s style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: normal; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: line-through;"&gt;quick google searches&lt;/s&gt; research.  Having failed to actually find Ayende's opinion on the matter in the first 5 minutes, I did come across this post (&lt;a href="http://lostechies.com/sharoncichelli/2010/03/19/rhino-mocks-examples-with-a-fix/" style="background-color: #e5f2ff; color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: normal; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;" title="lostechies.com"&gt;&lt;/a&gt;&lt;a href="http://lostechies.com/sharoncichelli/2010/03/19/rhino-mocks-examples-with-a-fix/"&gt;http://lostechies.com/sharoncichelli/2010/03/19/rhino-mocks-examples-with-a-fix/&lt;/a&gt;), which raised a point I &lt;s style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: normal; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: line-through;"&gt;did not realize &lt;/s&gt;had forgotten: &lt;/div&gt;
&lt;blockquote style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: italic; font-weight: normal; line-height: 24px; margin-bottom: 16px; margin-left: 16px; margin-right: 16px; margin-top: 16px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;
In Rhino Mocks, expectations on stubs are not verified; only mocks are verified. If an object is created with GenerateStub instead of GenerateMock, then its VerifyAllExpectations method doesn't do anything. This is non-obvious because the AssertWasCalled and AssertWasNotCalled methods on a stub will behave the way you want them to.&amp;nbsp; &lt;/blockquote&gt;
&lt;blockquote style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: italic; font-weight: normal; line-height: 24px; margin-bottom: 16px; margin-left: 16px; margin-right: 16px; margin-top: 16px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;
In Rhino Mocks, a stub can keep track of its interactions and assert that they happened, but it cannot record expectations and verify they were met. A mock can do both these things.&amp;nbsp; &lt;/blockquote&gt;
&lt;div style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: normal; line-height: 24px; margin-bottom: 12px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;
So, if you are using a Stub, you &lt;strong style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: bold; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;&lt;u style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: bold; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: underline;"&gt;must not&lt;/u&gt;&lt;/strong&gt; use .VerifyAllExpectations(), because it will always pass. &lt;/div&gt;
&lt;div style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: normal; line-height: 24px; margin-bottom: 12px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;
Now, one might argue (and many, &lt;em style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: italic; font-weight: normal; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;many&lt;/em&gt; on the Internet &lt;strong style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: bold; line-height: 24px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;do &lt;/strong&gt;argue) that a Stub should not have any expectations, so you shouldn't be calling either method. Stubs are for providing inputs to allow the code under test to run and limit your test to just the code under test, while Mocks are uses to validate behaviour. (they are one of the tests).&amp;nbsp; &lt;/div&gt;
&lt;div style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: normal; line-height: 24px; margin-bottom: 12px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;
&amp;nbsp; &lt;/div&gt;
&lt;div style="background-color: rgba(0, 0, 0, 0); color: #333333; font-family: Georgia, Times, 'Times New Roman', serif; font-size: 16px; font-style: normal; font-weight: normal; line-height: 24px; margin-bottom: 12px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; text-decoration: none;"&gt;
If someone does have a link to Ayende's opinion, please post as a comment or email/tweet me.  I'll update this post if I find it.&lt;br /&gt;
&lt;br /&gt;
Update: found this (&lt;a href="http://ayende.com/wiki/Rhino+Mocks+3.5.ashx#ExpectExtensionMethod"&gt;http://ayende.com/wiki/Rhino+Mocks+3.5.ashx#ExpectExtensionMethod&lt;/a&gt;) where it seems Ayende expects people to use either case (ie: he doesn't state here that one is "proper"). &amp;nbsp;I still seem to remember a blog he wrote stating a preference for one over the other, but I haven't yet found it).&lt;/div&gt;
&lt;/div&gt;
&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-2393542719459640970?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/siklyx1coGIgDcXAMQuma9EypD4/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/siklyx1coGIgDcXAMQuma9EypD4/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/siklyx1coGIgDcXAMQuma9EypD4/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/siklyx1coGIgDcXAMQuma9EypD4/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Eb-wUwQR9yY:QdZMk6tg_0U:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=Eb-wUwQR9yY:QdZMk6tg_0U:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Eb-wUwQR9yY:QdZMk6tg_0U:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Eb-wUwQR9yY:QdZMk6tg_0U:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Eb-wUwQR9yY:QdZMk6tg_0U:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Eb-wUwQR9yY:QdZMk6tg_0U:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/Eb-wUwQR9yY" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2011/06/on-rhinomocks-verifyallexpectations-vs.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/2393542719459640970?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/2393542719459640970?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/Eb-wUwQR9yY/on-rhinomocks-verifyallexpectations-vs.html" title="On Rhino.Mocks VerifyAllExpectations Vs AssertWasCalled" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2011/06/on-rhinomocks-verifyallexpectations-vs.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DUcNRH49cCp7ImA9WhRbEUg.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-3172338393519707553</id><published>2011-06-14T20:13:00.000-05:00</published><updated>2012-02-01T22:31:35.068-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2012-02-01T22:31:35.068-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Tools" /><category scheme="http://www.blogger.com/atom/ns#" term="TipsAndTricks" /><title>Cool new Visual Studio Ultimate debugger</title><content type="html">Microsoft has release a new Visual Studio Power Tool called “Debugger Canvas” that looks to be a very useful way to debug your apps.&amp;nbsp; Basically, instead of jumping from file to file while stepping through your code in debug mode, it will layout the callstack as method “bubbles” on a single tab, with local variable information available for each bubble:&lt;br /&gt;
&lt;br /&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://wbtqfq.bay.livefilestore.com/y1pu4R_XHKe633nLCia7L_MpVPdtLQD76Lj7XG2PSpDIwpIm6ugr5hEPvsvw3O0vFtQf6NM0cTOi4PLVWRm1TIbHQ/DebuggerCanvas%20.png?psid=1" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="337" src="http://wbtqfq.bay.livefilestore.com/y1pu4R_XHKe633nLCia7L_MpVPdtLQD76Lj7XG2PSpDIwpIm6ugr5hEPvsvw3O0vFtQf6NM0cTOi4PLVWRm1TIbHQ/DebuggerCanvas%20.png?psid=1" width="560" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There’s a really cool video demo on the &lt;a href="http://msdn.microsoft.com/en-us/devlabs/debuggercanvas"&gt;download page&lt;/a&gt; that I would suggest you watch.&lt;br /&gt;
&lt;br /&gt;
As well as this &lt;a href="http://www.zdnet.com/blog/microsoft/microsoft-poised-to-launch-new-visual-studio-debugging-tool/9676"&gt;overview blog\announcement&lt;/a&gt; by Mary Jo Foley&lt;br /&gt;
&lt;br /&gt;
Which points to this &lt;a href="http://blogs.msdn.com/b/somasegar/archive/2011/06/13/debugger-canvas-on-devlabs.aspx"&gt;announcement page&lt;/a&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-3172338393519707553?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/HgdbBxXHVj9L-l8DRjrtHKDTq8Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HgdbBxXHVj9L-l8DRjrtHKDTq8Y/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/HgdbBxXHVj9L-l8DRjrtHKDTq8Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/HgdbBxXHVj9L-l8DRjrtHKDTq8Y/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oHSLbFk-PbM:Ng7DKREXK7w:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=oHSLbFk-PbM:Ng7DKREXK7w:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oHSLbFk-PbM:Ng7DKREXK7w:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oHSLbFk-PbM:Ng7DKREXK7w:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oHSLbFk-PbM:Ng7DKREXK7w:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=oHSLbFk-PbM:Ng7DKREXK7w:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/oHSLbFk-PbM" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2011/06/cool-new-visual-studio-ultimate.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/3172338393519707553?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/3172338393519707553?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/oHSLbFk-PbM/cool-new-visual-studio-ultimate.html" title="Cool new Visual Studio Ultimate debugger" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2011/06/cool-new-visual-studio-ultimate.html</feedburner:origLink></entry><entry gd:etag="W/&quot;D0UDQHk-eyp7ImA9WhRQEE4.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-1176971529121003855</id><published>2011-03-21T17:15:00.006-05:00</published><updated>2011-12-04T15:47:51.753-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-12-04T15:47:51.753-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="Rhino.Mocks" /><category scheme="http://www.blogger.com/atom/ns#" term="TipsAndTricks" /><title>Using Rhino.Mocks - quick guide to generating mocks and stubs</title><content type="html">&lt;div class="MsoNoSpacing"&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;This post is a general
review of the Rhino.Mocks syntax. While it is intended primarily as a quick
reference for myself, I hope anyone who stumbles upon it can also find it
useful.&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 7.5pt;"&gt;Updated 3/21/11&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 7.5pt;"&gt;: corrected Throw() example. (Thanks Joe for the
catch!)&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 7.5pt;"&gt;Updated 6/21/11&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 7.5pt;"&gt;: added link in Mocks vs Stubs to another post
on VerifyAllExpectations vs AssertWasCalled, as well as link to posting with
simple explaination&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 7.5pt;"&gt;Updated 9/8/11&lt;/span&gt;&lt;/b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 7.5pt;"&gt;: added “Testing non-public members” section&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;As a &lt;/span&gt;&lt;span style="color: black; font-family: inherit;"&gt;quick &lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;into:
Rhino.Mocks (&lt;a href="http://www.ayende.com/projects/rhino-mocks.aspx" target="_blank"&gt;&lt;span style="color: blue;"&gt;http://www.ayende.com/projects/rhino-mocks.aspx&lt;/span&gt;&lt;/a&gt;)
is a .Net mocking framework which is extremely useful for stubbing out objects
in your unit tests to ensure you're only testing what you want to test and to
allow you to control the environment/state/surroundings under which your tests
execute. It is written by Ayende Rahien, the same guy that created nHibernate.
&amp;nbsp;My typical dev unit testing environment would be VS (C#) + nUnit +
Rhino.Mocks.&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;For readability, I
suggest the Arrange, Act, Assert syntax (&lt;a href="http://www.arrangeactassert.com/why-and-what-is-arrange-act-assert/" target="_blank"&gt;&lt;span style="color: blue;"&gt;http://www.arrangeactassert.com/why-and-what-is-arrange-act-assert/&lt;/span&gt;&lt;/a&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;This post is broken into
several sections, starting with a general overview and then hitting on several
specific use cases of interest:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 21.75pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -21.75pt;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Types of Mocks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 21.75pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -21.75pt;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Basics&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 21.75pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -21.75pt;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;General Layer
Abstraction&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 21.75pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -21.75pt;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Stubs vs Mocks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 21.75pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -21.75pt;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Modifiers for the
stubs/mocks&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 21.75pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -21.75pt;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Providing an alternate
implementation / Using the input params&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 21.75pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -21.75pt;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Throwing an Exception
instead&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 21.75pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -21.75pt;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Testing non-public
members&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: -.25in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: -.25in;"&gt;
&lt;b&gt;&lt;span style="color: #953735; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span style="color: #953735; font-family: 'Times New Roman', serif;"&gt;Note: Rhino.Mocks &amp;nbsp;can only mock/stub
virtual members of a real class, so make sure the members you care about are
virtual -- OR, my preference, mock/stub an Interface, in which case you can do
whatever you want.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: -.25in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;The surrounding code for
the code used in my examples can be found at the end of this posting.&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;span style="font-size: x-large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;
&lt;span style="font-size: x-large;"&gt;

Types of Mocks&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Rhino.Mocks supports
three basic types of mock objects:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;- Strict Mock&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;A strict mock requires
you to provide alternate implementations for each method/property that is used
on the mock. If any methods/properties are use which you have not provided
implementations for, an exception will be thrown.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;- Dynamic Mock&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;With a dynamic mock, any
&amp;nbsp;methods/properties which are called by your tests for which you have not
provided an implementation will return the default value for the data type of
the return value. &amp;nbsp;In other words, you'll get back a&amp;nbsp;&lt;i&gt;0&lt;/i&gt;&amp;nbsp;for
number types,&amp;nbsp;&lt;i&gt;false&lt;/i&gt;&amp;nbsp;for Booleans and a&amp;nbsp;&lt;i&gt;null&lt;/i&gt;&amp;nbsp;for
any object types.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;- Partial Mock&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;A partial mock will use
the underlying object's implementation if you don't provide an alternate
implementation. &amp;nbsp;So if you're only wanting to replace some of the
functionality (or properties), and keep the rest, you'll want to use this.
&amp;nbsp;For example, if you only want to override the method IsDatabaseActive(),
and leave the rest of the class as-is, you'll want to use a partial mock and
only provide an alternate implementation for IsDatabaseActive().&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;span style="font-size: x-large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;
&lt;span style="font-size: x-large;"&gt;

Basics&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;To generate mocks,
you'll use the static factory Rhino.Mocks.&lt;/span&gt;&lt;span style="color: #2b91af; font-family: 'Times New Roman', serif;"&gt;MockRepository.&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;From this factory, you'll create you mock using one of a few
generic methods (GenerateMock&amp;lt;T&amp;gt; for DynamicMocks,
GeneratePartialMock&amp;lt;T&amp;gt; or GenerateStrictMock&amp;lt;T&amp;gt;)&amp;nbsp;&amp;nbsp;where
the T is the class/interface being mocked.The method parameters, if you provide
any, will be passed to the object's constructor.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;As a general rule, I
will generate all of my mocks in the test suite [&lt;/span&gt;&lt;span style="color: #2b91af; font-family: 'Times New Roman', serif;"&gt;SetUp&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;] method to ensure
everything is reset from one test to the next.&amp;nbsp;&amp;nbsp;You'll see in my test
fixture file in the &lt;i&gt;Code Used In Examples&lt;/i&gt;
section that I have done just that.&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;span style="font-size: x-large;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;h1&gt;
&lt;span style="font-size: x-large;"&gt;

General Layer Abstraction&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;h2&gt;


&lt;span style="font-size: small;"&gt;&lt;span class="Heading2Char"&gt;Scenario&lt;/span&gt;&lt;span style="color: black;"&gt;:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;I have a BLL object that
I want to test, but it relies on a DAL object to fetch/update, etc records from
the database. I want to test my BLL object in isolation from the DAL object, so
I mock the DAL interface. &amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;span style="font-size: small;"&gt;

Things to note in this example:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;I generate a stub for
the dao's GetRecordFromDatabase() method so that when it's called with the
recordId I care about, it will return my prepared value. This removes the
dependency on the DAO layer (which is not even used since I'm mocking an
Interface for the DAO) and ensure's my test is controlling the inputs and
outputs to ensure I'm getting exactly what I want for my specific test
condition.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="font-size: x-small;"&gt;&amp;nbsp;&amp;nbsp;_mockDAO.Stub(dao
=&amp;gt; dao.GetRecordFromDatabase(myRecordId))&lt;/span&gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: x-small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2&gt;


&lt;span style="font-size: small;"&gt;&lt;br /&gt;
Code:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="font-size: x-small;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="font-family: Consolas;"&gt;&lt;span style="font-size: x-small;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;[&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas;"&gt;Test&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;]&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;void&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;TestGetImportantDataAndUpdateTheName()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas;"&gt;//Arrange&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;int&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;myRecordId = 100;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;var&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;recordFromDatabase
=&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas;"&gt;ImportantData&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Name
=&amp;nbsp;&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas;"&gt;"Orignal Name"&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;,&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RecordId
= myRecordId&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.Stub(dao
=&amp;gt; dao.GetRecordFromDatabase(myRecordId))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas;"&gt;//Act&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;var&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;myRecord =
_fancyBL.GetImportantDataAndUpdateTheName(myRecordId);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas;"&gt;//Assert&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas;"&gt;Assert&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;.AreEqual(myRecord.RecordId,
myRecordId);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas;"&gt;Assert&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;.AreEqual(myRecord.Name,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas;"&gt;"All Your Base Are Belong To Us"&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;br /&gt;&lt;/h1&gt;
&lt;h1&gt;


Stubs vs Mocks&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;A stub is simply an
alternate implementation. A mock, however, is more than that. A mock sets up
an&amp;nbsp;&lt;b&gt;&lt;i&gt;expectation&lt;/i&gt;&lt;/b&gt;&amp;nbsp;that&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;1)&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;A specific method will be called&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;2)&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;It will be called with the provided inputs&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;3)&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;It will return the provided results&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;So when you setup a
mock, you use the syntax .Expect() instead of .Stub().&amp;nbsp;&amp;nbsp;Then, in your
asserts, you can do . VerifyAllExpectations() on your mock to ensure reality
matched your expectations.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;In this example, the
test will fail due to an ExpectationViolationException being thrown due to the
Expect(101) not being called.&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;[&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas;"&gt;Test&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;]&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;void&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;TestExpectations()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas;"&gt;////Arrange&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;int&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;myRecordId = 100;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;var&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;recordFromDatabase
=&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas;"&gt;ImportantData&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Name
=&amp;nbsp;&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas;"&gt;"Orignal Name"&lt;/span&gt;&lt;span style="color: black; font-family: Consolas;"&gt;,&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RecordId
= myRecordId&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;};&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.Expect(dao
=&amp;gt; dao.GetRecordFromDatabase(myRecordId))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.Expect(dao
=&amp;gt; dao.GetRecordFromDatabase(101))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas;"&gt;//Act&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_fancyBL.GetImportantDataAndUpdateTheName(myRecordId);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas;"&gt;//Assert&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.VerifyAllExpectations();&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: x-small;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;b&gt;&lt;u&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Update&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;:
see&amp;nbsp;&lt;a href="http://wrightthisblog.blogspot.com/2011/06/on-rhinomocks-verifyallexpectations-vs.html"&gt;&lt;span style="color: blue;"&gt;my post&amp;nbsp;for more on VerifyAllExpectations vs
AssertWasCalled methods&lt;/span&gt;&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;b&gt;&lt;u&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Update&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;:
found a posting that I think does a&lt;a href="http://osherove.com/blog/2007/9/16/mocks-and-stubs-the-difference-is-in-the-flow-of-information.html"&gt;&lt;span style="color: blue;"&gt;&amp;nbsp;good, simple&amp;nbsp;explanation&amp;nbsp;of Mock vs Stub&lt;/span&gt;&lt;/a&gt;,
including a graphic!&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;br /&gt;&lt;/h1&gt;
&lt;h1&gt;


Modifiers for the stubs/mocks&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;In the above example, I
did _mockDAO.Stub().Return().&amp;nbsp;&amp;nbsp;This will cause the mock object to
return the provide value&amp;nbsp;&lt;b&gt;the first time it's called&lt;/b&gt;&amp;nbsp;with the
provided inputs.&amp;nbsp;&amp;nbsp;Sometimes we want to change this behavior, thus the
following modifiers can be used between the .Stub() and .Return() calls.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;span style="font-size: small;"&gt;

Change how many times to use the stub:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div class="MsoNormal" style="margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Using the .Repeat.Any(),
.Repeat.Once(), Repeat.Times(10)&amp;nbsp;modifiers:&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.Stub(dao
=&amp;gt; dao.GetRecordFromDatabase(myRecordId))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Repeat.Any()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;span style="font-size: small;"&gt;

Return the prepared value regardless of the input value:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Using .IgnoreArguments():&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 12pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.Stub(dao
=&amp;gt; dao.GetRecordFromDatabase(myRecordId))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.IgnoreArguments()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;span style="font-size: small;"&gt;

Advanced Argument Constraints:&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/h2&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;You can provide very
detailed conditions for when to use your return values by defining
per-parameter constraints. For example, here I've said the input must be
greater than 0.&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;_mockDAO.Stub(dao =&amp;gt;
dao.GetRecordFromDatabase(&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Arg&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;int&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;gt;.Is.GreaterThanOrEqual(0)))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Here's an example with
more than one parameter: (There's a lot more than this – IntelliSense is your
friend)&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;_mockDAO.Stub(dao =&amp;gt;
dao.GetRecordFromDatabase(&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Arg&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;int&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;gt;.Is.GreaterThanOrEqual(0),&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Arg&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;decimal&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;gt;.Is.NotEqual(2.0),&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Arg&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;List&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;string&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;gt;&amp;gt;.List.ContainsAll(&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;List&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;string&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;gt; {&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;"&gt;"foo"&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;"&gt;"bar"&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;}),&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Arg&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;object&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;gt;.Is.NotNull,&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Arg&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;object&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;gt;.Is.Anything))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Additionally, you can
put constraints on properties of objects used as parameters. For instance, if
the input parameter had a bool property "IsSomethingICareAbout" and
you only wanted to provide a return value when that property is true, you could
do this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.Stub(x
=&amp;gt; x.SomeMethod(myObject))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Constraints(&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Property&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;.Value(&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;"&gt;"IsSomethingICareAbout"&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;true&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;)&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;"&gt;"foo"&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;You can put constraints
on the input arguments in the same way:&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.Stub(dao
=&amp;gt; dao.GetRecordFromDatabase(0))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Constraints(&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Is&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;.GreaterThanOrEqual(0))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;And constraints can be
chained with boolean operators:&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.Stub(dao
=&amp;gt; dao.GetRecordFromDatabase(0))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Constraints(&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Is&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;.GreaterThanOrEqual(0)
&amp;amp;&amp;amp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Is&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;.LessThanOrEqual(100) )&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Return(recordFromDatabase);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b&gt;Note: Constraints
must be listed in the order of the parameters (ie: the first set of constraints
apply to the first parameter, the second set to the second param, and so
on).&amp;nbsp;&amp;nbsp;And a constraint must be provided for each parameter (you can
do Is.Anything() as well).&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;br /&gt;&lt;/h1&gt;
&lt;h1&gt;


Providing an alternate implementation / Using the input params&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Instead of using a
.Return() with a simple value, you can provide a full implementation of the
method using the .Do() method. This also allows you to get access to the input
parameters.&amp;nbsp;&amp;nbsp;If you want, you can define a delegate and just call the
delegate.&amp;nbsp;&amp;nbsp;I prefer to use lamdas unless the method is really long.&amp;nbsp;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman', serif;"&gt;So instead of my
previous stub for GetRecordForDatabase which pre-configured a return value, I
can do it on the fly:&lt;/span&gt;&lt;br /&gt;
&lt;span style="font-family: 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; text-indent: .5in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;_mockDAO.Stub(dao =&amp;gt;
dao.GetRecordFromDatabase(0))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.IgnoreArguments()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Repeat.Any()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Do((&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Func&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;int&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;ImportantData&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;gt;)(input
=&amp;gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;ImportantData&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;Name
=&amp;nbsp;&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas; font-size: 9.5pt;"&gt;"Orignal Name"&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;,&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;RecordId
= input&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}));&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;br /&gt;&lt;/h1&gt;
&lt;h1&gt;


Throwing an Exception instead&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Instead of .Return(),
you can use .Throw() to force an exception:&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;Test&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;,&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;ExpectedException&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;(&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;typeof&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;(&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;NullReferenceException&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;))]&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;void&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;TestNeverCallThisMethod2()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas; font-size: 9.5pt;"&gt;//Arrange&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO.Stub(dao
=&amp;gt; dao.GetRecordFromDatabase(0))&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.IgnoreArguments()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Repeat.Any()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;.Throw(new&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 10pt;"&gt;NullReferenceException()&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 10pt;"&gt;);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;object&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;inputValue =&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;null&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas; font-size: 9.5pt;"&gt;//Act&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_fancyBL.NullsNotWelcomeHere(inputValue);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas; font-size: 9.5pt;"&gt;//Assert&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas; font-size: 9.5pt;"&gt;//nothing to do here -- ExpectedException&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;br /&gt;&lt;/h1&gt;
&lt;h1&gt;


Testing non-public members&lt;span style="font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h1&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;With Rhino.Mocks, you
can't mock private or protected members, but you can mock internal members if
you do a little extra work.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Specifically, you must
allow your test assembly to access internal members of the assembly under
test.&amp;nbsp;&amp;nbsp;This means adding&amp;nbsp;&amp;nbsp;two InternalsVisibleToAttributes
to the AssemblyInfo.cs file of the assembly under test: one for the unit test assembly
and one for Rhino.Mocks' DynamicProxyGenAssembly2.&amp;nbsp;&amp;nbsp;If you're using
signed assemblies, you must put the full public key in the attribute.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;You can get the public key for an assembly by using the "sn -Tp yourAssembly.dll" command in the Visual Studio Command Prompt.&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;For example: (no
wrapping -- can't be any spaces in the public key)&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;[&lt;span style="color: blue;"&gt;assembly&lt;/span&gt;: &lt;span style="color: #2b91af;"&gt;InternalsVisibleTo&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"DynamicProxyGenAssembly2,
PublicKey=0024000004800000940000000602000000240000525341310004000001000100c547cac37abd99c8db225ef2f6c8a3602f3b3606cc9891605d02baa56104f4cfc0734aa39b93bf7852f7d9266654753cc297e7d2edfe0bac1cdcf9f717241550e0a7b191195b7667bb4f64bcb8e2121380fd1d9d46ad2d92d2d15605093924cceaf74c4861eff62abf69b9291ed0a340e113be11e6a7d3113e92484cf7045cc7"&lt;/span&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: Consolas; font-size: 9.5pt;"&gt;[&lt;span style="color: blue;"&gt;assembly&lt;/span&gt;: &lt;span style="color: #2b91af;"&gt;InternalsVisibleTo&lt;/span&gt;(&lt;span style="color: #a31515;"&gt;"jwright.Blog.UnitTesting,
PublicKey=00……ec"&lt;/span&gt;)]&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h1&gt;
&lt;br /&gt;&lt;/h1&gt;
&lt;h1&gt;


Code Used In Examples&lt;o:p&gt;&lt;/o:p&gt;&lt;/h1&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: 'Times New Roman', serif;"&gt;Here are the code files
I'll use in my example tests:&lt;span style="font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Courier; font-size: 10pt;"&gt;&lt;br /&gt;
&amp;lt;DataAccessObject.cs&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;using&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;System;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;namespace&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;jwright.Blog&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;public&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;class&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;ImportantData&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;public&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;string&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;Name {&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;get&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;set&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;public&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;int&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;RecordId {&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;get&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;set&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;public&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;interface&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;IDataAccess&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;ImportantData&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;GetRecordFromDatabase(&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;int&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;recordId);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;void&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;NeverCallThisMethod();&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;public&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;class&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;DataAccessObject&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;:&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;IDataAccess&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;public&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;ImportantData&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;GetRecordFromDatabase(&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;int&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;recordId)&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;
&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;throw&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;new&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style="color: darkblue; font-family: Consolas; font-size: 9pt;"&gt;NotImplementedException&lt;/span&gt;&lt;/b&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;(); }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;public&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;void&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;NeverCallThisMethod()
{&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;throw&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;new&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;b&gt;&lt;span style="color: darkblue; font-family: Consolas; font-size: 9pt;"&gt;NotImplementedException&lt;/span&gt;&lt;/b&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;();
}&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;}&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Courier; font-size: 10pt;"&gt;&amp;lt;FancyBusinessLogic.cs&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;namespace&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;jwright.Blog&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;internal&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;class&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;FancyBusinessLogic&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;private&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;IDataAccess&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;_dataAccessObject;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;internal&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;IDataAccess&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;MyDataAccessObject&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;get&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;{&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;return&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;_dataAccessObject
?? (_dataAccessObject =&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;new&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;DataAccessObject&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;()); }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;set&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;{
_dataAccessObject =&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;value&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;public&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9pt;"&gt;ImportantData&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;GetImportantDataAndUpdateTheName(&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;int&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;recordId)&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;var&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;record =
MyDataAccessObject.GetRecordFromDatabase(recordId);&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
record.Name =&amp;nbsp;&lt;/span&gt;&lt;span style="color: #a31515; font-family: Consolas; font-size: 9pt;"&gt;"All Your Base
Are Belong To Us"&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;return&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;record;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;public&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;void&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;NullsNotWelcomeHere(&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;object&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;input)&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;if&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;(input ==&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;null&lt;/span&gt;&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;) {
MyDataAccessObject.NeverCallThisMethod(); }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;}&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Courier; font-size: 10pt;"&gt;&amp;lt;FancyBusinessLogicTest.cs&amp;gt;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;using&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;System;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;using&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;NUnit.Framework;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;using&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;Rhino.Mocks;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;namespace&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;jwright.Blog&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;TestFixture&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;]&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;class&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;FancyBusinessLogicTest&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;private&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;IDataAccess&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;_mockDAO;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;private&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;FancyBusinessLogic&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;_fancyBL;&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;SetUp&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;]&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;public&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;void&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;SetUp()&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;{&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas; font-size: 9.5pt;"&gt;//reset all my objects under test and mocks&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_mockDAO
=&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;MockRepository&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;.GenerateMock&amp;lt;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;IDataAccess&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;gt;();&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;_fancyBL
=&amp;nbsp;&lt;/span&gt;&lt;span style="color: blue; font-family: Consolas; font-size: 9.5pt;"&gt;new&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span style="color: #2b91af; font-family: Consolas; font-size: 9.5pt;"&gt;FancyBusinessLogic&lt;/span&gt;&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;{MyDataAccessObject
= _mockDAO};&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas; font-size: 9.5pt;"&gt;//-----&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas; font-size: 9.5pt;"&gt;// Tests will go here&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: black; font-family: Consolas; font-size: 9.5pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: green; font-family: Consolas; font-size: 9.5pt;"&gt;//-----&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="color: #010101; font-family: Consolas; font-size: 9pt;"&gt;}&lt;/span&gt;&lt;span style="color: black; font-family: 'Times New Roman', serif; font-size: 13.5pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-1176971529121003855?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/3O2Gman022bxJGMoLYBvjKJa-cE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3O2Gman022bxJGMoLYBvjKJa-cE/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/3O2Gman022bxJGMoLYBvjKJa-cE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/3O2Gman022bxJGMoLYBvjKJa-cE/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xQEoTtegXwM:QylhuxxM_V0:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=xQEoTtegXwM:QylhuxxM_V0:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xQEoTtegXwM:QylhuxxM_V0:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xQEoTtegXwM:QylhuxxM_V0:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xQEoTtegXwM:QylhuxxM_V0:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xQEoTtegXwM:QylhuxxM_V0:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/xQEoTtegXwM" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2011/03/using-rhinomocks-quick-guide-to.html#comment-form" title="2 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/1176971529121003855?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/1176971529121003855?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/xQEoTtegXwM/using-rhinomocks-quick-guide-to.html" title="Using Rhino.Mocks - quick guide to generating mocks and stubs" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>2</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2011/03/using-rhinomocks-quick-guide-to.html</feedburner:origLink></entry><entry gd:etag="W/&quot;Ak4AQ3czcCp7ImA9WhZTEk4.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-5180088725619686353</id><published>2011-03-15T20:29:00.000-05:00</published><updated>2011-03-15T20:29:02.988-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-15T20:29:02.988-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TipsAndTricks" /><title>Blogger formatting frustrations</title><content type="html">&lt;p&gt;I haven&amp;#39;t been posting new blogs for a while after getting fed up with how difficult it is to get nicely formatted code snippets into Blogger. Using the site's rich text editor strips out much of the whitespace (tabs and carriage returns,  in particular) making the code unreadable. I really just wanted to copy&amp;amp;paste my code from Visual Studio and keep the format, the font colors, etc.

&lt;p&gt;I started the process of setting up my own WordPress instance (using MS WebMatrix), but was concerned about losing the links to my old posts, etc.

&lt;p&gt;Then it occurred to me that Blogger has an email-to-post feature - and it supports HTML emails. So, I just need to craft my posts as rich text emails and submit them that way. Much easier!

&lt;p&gt;Now if only I could draft HTML emails from my iPhone. At least I can edit them in another app and copy&amp;amp;paste into the mail client.

&lt;p&gt;So, expect some blogs in the next week. I&amp;#39;m working on some unit testing related posts, beginning with a Rhino.Mocks overview (mainly for some of the folks at my new job).&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-5180088725619686353?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/_MCXs3Te_J6XQ29qiO__u-GZZec/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_MCXs3Te_J6XQ29qiO__u-GZZec/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/_MCXs3Te_J6XQ29qiO__u-GZZec/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/_MCXs3Te_J6XQ29qiO__u-GZZec/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uWSRyCXqmDE:Xz8WF51SHyU:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=uWSRyCXqmDE:Xz8WF51SHyU:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uWSRyCXqmDE:Xz8WF51SHyU:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uWSRyCXqmDE:Xz8WF51SHyU:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uWSRyCXqmDE:Xz8WF51SHyU:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uWSRyCXqmDE:Xz8WF51SHyU:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/uWSRyCXqmDE" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2011/03/blogger-formatting-frustrations.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/5180088725619686353?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/5180088725619686353?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/uWSRyCXqmDE/blogger-formatting-frustrations.html" title="Blogger formatting frustrations" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2011/03/blogger-formatting-frustrations.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CE8CQnwzfip7ImA9Wx9RE0g.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-7161187712764563741</id><published>2010-12-14T12:54:00.000-06:00</published><updated>2010-12-14T12:54:23.286-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-12-14T12:54:23.286-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TipsAndTricks" /><title>.Net Knowledge Nuggets: A Note About Unicode</title><content type="html">A while back, one of my coworkers sent out a late-night plea for help with a unicode issue he was having. I thought I'd post the conversation here (slightly censored) for future reference:&lt;br /&gt;
&lt;br /&gt;
Original email from coworker:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
I’m
looking for a little .NET help – particularly with the MailMessage
class.&amp;nbsp;&amp;nbsp;&amp;nbsp; I’m pulling the contents of an HTML page which is in
French (and displaying properly in the webpage) and sending it via an
email.&amp;nbsp;&amp;nbsp; I’m having difficulty getting the mail to use the correct
encoding to show all the special characters correctly .&amp;nbsp;&amp;nbsp; If anyone has
any experience doing this –please let me know.&lt;/blockquote&gt;
&lt;br /&gt;
&amp;nbsp;My reply:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
Make sure you're setting the
.BodyEncoding property to Unicode. If you're getting "?" chars where
special chars should be, it may actually be a problem with the way you're
importing the content (the HTML could be getting munged before going into the
MailMessage body). Take a look here:&amp;nbsp;&lt;a href="http://bytes.com/topic/asp-net/answers/345431-sending-mail-message-unicode-text"&gt;http://bytes.com/topic/asp-net/answers/345431-sending-mail-message-unicode-text&lt;/a&gt;&lt;/blockquote&gt;
&lt;div class="MsoNormal" style="margin-bottom: 12.0pt;"&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;

&lt;!--[if !supportLineBreakNewLine]--&gt;Coworker initial reply:
&lt;!--[endif]--&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;
Thanks – I’m going to take a crack at this tomorrow.&amp;nbsp;&amp;nbsp;
I’ve tried all the different encodings on the .BodyEncoding property but no
luck.&amp;nbsp;&amp;nbsp; So I think you are right – it might be the way I am pulling
the HTML.&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; What a freaking pain.&lt;/blockquote&gt;
And follow-up:&lt;br /&gt;
&lt;blockquote&gt;
You were right.&amp;nbsp;&amp;nbsp; That worked.&amp;nbsp; I owe you a beer
– remind me to buy it for you next happy hour.&lt;/blockquote&gt;
&lt;br /&gt;
That reminds me -- I need to collect on that beer.&lt;br /&gt;
&lt;br /&gt;
Remember that if you don't handle Unicode correctly in every place you manipulate the bytes (from initial read to final write), you run the chance of munging the bits because some string or character library is assuming 8-bit chars or assumes the wrong encoding. &amp;nbsp;The key here was to ensure the initial read was reading it as Unicode -- something like this:&lt;br /&gt;
&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px; font-family: verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 22px;"&gt;var myReader = new StreamReader(fileName,&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="-webkit-border-horizontal-spacing: 1px; -webkit-border-vertical-spacing: 1px; font-family: verdana, Arial, Helvetica, sans-serif; font-size: 12px; line-height: 22px;"&gt;System.Text.Encoding.Unicode);&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-7161187712764563741?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2aXOdUFyg0QM9a1GWvwBU0F6Gjc/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2aXOdUFyg0QM9a1GWvwBU0F6Gjc/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/2aXOdUFyg0QM9a1GWvwBU0F6Gjc/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2aXOdUFyg0QM9a1GWvwBU0F6Gjc/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=zSjvZXF3WCg:iSkmd0nJqoA:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=zSjvZXF3WCg:iSkmd0nJqoA:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=zSjvZXF3WCg:iSkmd0nJqoA:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=zSjvZXF3WCg:iSkmd0nJqoA:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=zSjvZXF3WCg:iSkmd0nJqoA:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=zSjvZXF3WCg:iSkmd0nJqoA:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/zSjvZXF3WCg" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2010/12/net-knowledge-nuggets-note-about.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/7161187712764563741?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/7161187712764563741?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/zSjvZXF3WCg/net-knowledge-nuggets-note-about.html" title=".Net Knowledge Nuggets: A Note About Unicode" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2010/12/net-knowledge-nuggets-note-about.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEUDRX49cSp7ImA9Wx5XFkk.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-4110003779857382569</id><published>2010-09-16T08:04:00.000-05:00</published><updated>2010-09-16T08:04:34.069-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-09-16T08:04:34.069-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TipsAndTricks" /><title>.Net Knowledge Nuggets: Dynamically Ignoring Unit Tests</title><content type="html">&lt;br /&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
During a client
project, we had a set of unit tests that connected to a webservice hosted on a
client server which utilized Windows Authentication and would reject requests
coming from our local dev environments (since we, as consultants, had laptops
that weren't on the client's AD domain).&amp;nbsp;
This resulted in false-negative tests and&amp;nbsp;in my experience, when you start having "known bad" tests that
always fail, people start to ignore failing unit tests, which is not what you
want.&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
So, to keep from
having false-negative tests, I modified that particular suite of tests to
auto-ignore the tests if the current environment is not on the right AD
domain.&amp;nbsp; This would keep them from
showing as failures on our local dev environments, but they would fully run on
our build server (vs. marking them as permanently ignored, where they wouldn't
run on the CI server).&amp;nbsp; Here's what I
did:&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/// &amp;lt;summary&amp;gt;&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/// Will dynamically mark a test as Ignored if the system running the test is not&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/// on the SOMECLIENT domain. This is because the API will fail authentication&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/// otherwise and will provide false negative results&amp;nbsp;&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;/// &amp;lt;/summary&amp;gt;&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;public static void IgnoreTestIfOffDomain()&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;try&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var domain = System.DirectoryServices.ActiveDirectory.Domain.GetCurrentDomain();&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var domainName = domain.Name.ToUpper();&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;if (!domainName.ToUpper().Contains("SOMEDOMAINNAME"))&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Assert.Ignore("NOT RUNNING API TESTS from current domain " + domain.Name);&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;catch (ActiveDirectoryOperationException)&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Assert.Ignore("NOT RUNNING API TESTS from current domain (domain missing)");&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;div style="margin-bottom: 0in; margin-left: 0.375in; margin-right: 0in; margin-top: 0in;"&gt;
&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/div&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
Note that an
ActiveDirectoryOperationException will be thrown if the system is not currently
registered on a domain, thus the try/catch.&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
I put this into a method which I called in the TestFixtureSetup or individual test methods, depending if I wanted to ignore the whole suite or the&amp;nbsp;individual&amp;nbsp;tests.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-4110003779857382569?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/X2bBjDEclz6FO5ezcrK4Pt5ywrg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/X2bBjDEclz6FO5ezcrK4Pt5ywrg/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/X2bBjDEclz6FO5ezcrK4Pt5ywrg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/X2bBjDEclz6FO5ezcrK4Pt5ywrg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xyoWsfbu_4o:rAdR-7Mpags:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=xyoWsfbu_4o:rAdR-7Mpags:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xyoWsfbu_4o:rAdR-7Mpags:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xyoWsfbu_4o:rAdR-7Mpags:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xyoWsfbu_4o:rAdR-7Mpags:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=xyoWsfbu_4o:rAdR-7Mpags:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/xyoWsfbu_4o" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2010/09/net-knowledge-nuggets-dynamically.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/4110003779857382569?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/4110003779857382569?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/xyoWsfbu_4o/net-knowledge-nuggets-dynamically.html" title=".Net Knowledge Nuggets: Dynamically Ignoring Unit Tests" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2010/09/net-knowledge-nuggets-dynamically.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04HRnY5fip7ImA9WxFaEko.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-2077002365334639023</id><published>2010-07-15T08:01:00.001-05:00</published><updated>2010-07-16T06:32:17.826-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-07-16T06:32:17.826-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="UserGroups" /><category scheme="http://www.blogger.com/atom/ns#" term="Networking" /><title>West Monroe Partners again sponsoring Chicago Architects Group</title><content type="html">&lt;br /&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
My employer, &lt;a href="http://www.westmonroepartners.com/"&gt;West Monroe Partners&lt;/a&gt;,
will once again be sponsoring the &lt;a href="http://chicagoarchitectsgroup.com/"&gt;Chicago Architects Group&lt;/a&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&lt;/span&gt;monthly meeting Tue, July 20th.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Chicago
has a strong technical community and &lt;a href="http://wrightthisblog.blogspot.com/2010/05/west-monroe-partners-sponsoring-chicago.html"&gt;as I've mentioned before&lt;/a&gt;,
I'm proud to see WMP support the continued growth and learning of the community
at large.&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
This month's topic
is "Architecture And Business Intelligence" by David Leininger.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Details and registration can be found at &lt;a href="http://chicagoarchitectsgroup.eventbright.com/"&gt;http://chicagoarchitectsgroup.eventbright.com/&lt;/a&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Presentation begins at 5:30pm at the
ITA/TexusNexus space in the Loop.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;
&lt;/span&gt;Attendance is free thanks to corporate sponsorships, such as West Monroe
Partners!&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
I hope you'll join
me there!&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
Chicago Architects
Group was founded on the goal to unit various technical architecture
competencies into a community for collaboration and knowledge sharing. The
group is for people to meet their peers and share some stories and ideas.
Architects and those aspiring to understand technical architecture better will
enjoy this group. (text from &lt;a href="http://chicagoarchitectsgroup.com/"&gt;http://chicagoarchitectsgroup.com&lt;/a&gt;).&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin: 0in;"&gt;
&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 0in;"&gt;
&lt;div style="margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div class="separator" style="clear: left; font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KPiFUmlaI/AAAAAAAAALc/sk4DinwCRjw/s1600/CAGLogo.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KPiFUmlaI/AAAAAAAAALc/sk4DinwCRjw/s320/CAGLogo.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: right; font-family: 'Times New Roman'; font-size: medium; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KP9PV615I/AAAAAAAAALk/sp3N3CWkw8U/s1600/WestMonroe.logo.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KP9PV615I/AAAAAAAAALk/sp3N3CWkw8U/s320/WestMonroe.logo.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div style="font-family: Calibri; font-size: 11pt; margin-bottom: 0in; margin-left: 0in; margin-right: 0in; margin-top: 0in;"&gt;
&lt;/div&gt;
&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-2077002365334639023?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2-312szvXPsyJkmZGhvvgatGhUg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2-312szvXPsyJkmZGhvvgatGhUg/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/2-312szvXPsyJkmZGhvvgatGhUg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2-312szvXPsyJkmZGhvvgatGhUg/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=sxRAfeJjMbY:ROr9kXWiqWc:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=sxRAfeJjMbY:ROr9kXWiqWc:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=sxRAfeJjMbY:ROr9kXWiqWc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=sxRAfeJjMbY:ROr9kXWiqWc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=sxRAfeJjMbY:ROr9kXWiqWc:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=sxRAfeJjMbY:ROr9kXWiqWc:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/sxRAfeJjMbY" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2010/07/west-monroe-partners-again-sponsoring.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/2077002365334639023?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/2077002365334639023?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/sxRAfeJjMbY/west-monroe-partners-again-sponsoring.html" title="West Monroe Partners again sponsoring Chicago Architects Group" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KPiFUmlaI/AAAAAAAAALc/sk4DinwCRjw/s72-c/CAGLogo.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2010/07/west-monroe-partners-again-sponsoring.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DU4FR34-eip7ImA9WxFXEUU.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-6815372034679453633</id><published>2010-05-18T08:05:00.000-05:00</published><updated>2010-05-18T08:05:16.052-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-05-18T08:05:16.052-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="UserGroups" /><category scheme="http://www.blogger.com/atom/ns#" term="Networking" /><title>West Monroe Partners Sponsoring Chicago Architects Group</title><content type="html">&lt;br /&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
For
over a year now I've been attending technical user group meetings across the
Chicago area and one in particular has caught my interest more than the others.
The &lt;a href="http://chicagoarchitectsgroup.com/"&gt;Chicago Architects Group&lt;/a&gt; ("CAG") has consistently provided presentations and discussion on&amp;nbsp; topics relevant to me and by presenters with
experience and knowledge on the subjects at hand.&amp;nbsp; Presentations has ranged from &lt;a href="http://wrightthisblog.blogspot.com/2010/01/dependency-injections-and-inversion-of.html"&gt;Dependency Injection &amp;amp; Inversion of Control Containers&lt;/a&gt;, to Onion Architecture, to
Agile Project Management strategies. And tonight will be Azure for
Architects.&amp;nbsp; All targeted to the
technical architect audience, who discuss the topics, share personal
experiences and insights.&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
Shift
gears now to one of the reason I enjoy working for West Monroe Partners: WMP
has a set of values core to the culture of the company that help make the
company a great place to work:&lt;/div&gt;
&lt;ul style="direction: ltr; margin-bottom: 0in; margin-left: .375in; margin-top: 0in; unicode-bidi: embed;" type="disc"&gt;
&lt;li style="margin-bottom: 0; margin-top: 0; vertical-align: middle;"&gt;&lt;span style="font-family: Calibri; font-size: 11pt;"&gt;A culture of learning and
     growth&lt;/span&gt;&lt;/li&gt;
&lt;li style="margin-bottom: 0; margin-top: 0; vertical-align: middle;"&gt;&lt;span style="font-family: Calibri; font-size: 11pt;"&gt;The belief that our clients
     should learn and grow with us&lt;/span&gt;&lt;/li&gt;
&lt;li style="margin-bottom: 0; margin-top: 0; vertical-align: middle;"&gt;&lt;span style="font-family: Calibri; font-size: 11pt;"&gt;The belief that diverse
     experiences and thought are required to develop a balanced set of
     knowledge and skills&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
So
now I am happy to be able to bring these two groups together, I believe to the
mutual benefit of all: this month &lt;a href="http://www.westmonroepartners.com/"&gt;West Monroe Partners&lt;/a&gt; &amp;nbsp;will be sponsoring the CAG meeting by funding the food and drinks. And there
are plans in place to further sponsor at least two more meetings this
year.&amp;nbsp; So what does this mean?&amp;nbsp; Well, it means that CAG meets continue to be
free to anyone who wants to attend.&amp;nbsp; It
means that people can continue to learn about new skills, new technologies or
alternate views on existing skills for the purpose of learning and growing and
picking up on the experiences of others.&amp;nbsp;
It's a small way for WMP to help a community group continue to grow and
better the larger technical community and I hope it's a pattern that will
continue.&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
And
it means I continue to get free pizza -- which helps offset the long commute
back to the 'burbs when staying downtown for after-hours meetings. :-)&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: left; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KPiFUmlaI/AAAAAAAAALc/sk4DinwCRjw/s1600/CAGLogo.png" imageanchor="1" style="clear: left; float: left; margin-bottom: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KPiFUmlaI/AAAAAAAAALc/sk4DinwCRjw/s320/CAGLogo.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: right; text-align: center;"&gt;
&lt;a href="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KP9PV615I/AAAAAAAAALk/sp3N3CWkw8U/s1600/WestMonroe.logo.jpg" imageanchor="1" style="clear: right; float: right; margin-bottom: 1em; margin-left: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KP9PV615I/AAAAAAAAALk/sp3N3CWkw8U/s320/WestMonroe.logo.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div style="font-family: Calibri; font-size: 11.0pt; margin-left: .375in; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-6815372034679453633?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/CvCuJz7vg_10c9txmYqjVESi4pY/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CvCuJz7vg_10c9txmYqjVESi4pY/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/CvCuJz7vg_10c9txmYqjVESi4pY/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/CvCuJz7vg_10c9txmYqjVESi4pY/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=0anh7WuPfqo:zyEBYT-McCg:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=0anh7WuPfqo:zyEBYT-McCg:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=0anh7WuPfqo:zyEBYT-McCg:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=0anh7WuPfqo:zyEBYT-McCg:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=0anh7WuPfqo:zyEBYT-McCg:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=0anh7WuPfqo:zyEBYT-McCg:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/0anh7WuPfqo" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2010/05/west-monroe-partners-sponsoring-chicago.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/6815372034679453633?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/6815372034679453633?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/0anh7WuPfqo/west-monroe-partners-sponsoring-chicago.html" title="West Monroe Partners Sponsoring Chicago Architects Group" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="http://3.bp.blogspot.com/_YzDUQEL_ycQ/S_KPiFUmlaI/AAAAAAAAALc/sk4DinwCRjw/s72-c/CAGLogo.png" height="72" width="72" /><thr:total>0</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2010/05/west-monroe-partners-sponsoring-chicago.html</feedburner:origLink></entry><entry gd:etag="W/&quot;AkcHSHs8fip7ImA9WxBWEEU.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-1991867797187788602</id><published>2010-02-01T23:20:00.000-06:00</published><updated>2010-02-01T23:20:39.576-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-02-01T23:20:39.576-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="UserGroups" /><title>Node.js, et al: Highlights from JavaScript Chicago January Meeting</title><content type="html">&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
&lt;em&gt;&lt;span style="color: black; font-family: Arial, sans-serif; font-size: 10pt; line-height: 115%;"&gt;(Each month I plan to attend
technical user groups in the Chicago area to (re-)learn from peers experiences
with new and existing technologies and to network with like-minded techies.
This blog is one in a series of recaps of some of the more interesting aspects
of the meetings for my own purposes (this is a “web log” afterall) and for
others to get a general taste of what’s available in the Chicago user group
scene.)&lt;/span&gt;&lt;/em&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;User Group: &lt;/b&gt;JavaScript
Chicago (JS.chi)&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://javascriptchicago.com/"&gt;http://javascriptchicago.com&lt;/a&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;a href="http://www.meetup.com/js-chi/"&gt;http://www.meetup.com/js-chi/&lt;/a&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b style="mso-bidi-font-weight: normal;"&gt;Twitter&lt;/b&gt;: @chicagojs&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;b style="mso-bidi-font-weight: normal;"&gt;Location:&lt;/b&gt; CashNetUSA (200 W Jackson –
In the Loop)&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;Meeting Date:&lt;/b&gt;
Thursday, January 20, 2010&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
The js.chi meetings follow a format of two main
presentations, followed by three “lightning talks” (5-min quick presentations –
although I have only seen one actually achieve the 5-min timeframe).&amp;nbsp;&amp;nbsp; Fairly large attendance again (20 – 30
attendees, from what I could tell), but had audio problems again, which meant
it was difficult to hear beyond the first five rows or so (hint: arrive early
to get a good seat – beers/sodas and networking before the meeting to help it
along). &lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;Presentations:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;u&gt;Prototypal Inheritance&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
This month, the opening presentation was an overview of
prototypal inheritance in JavaScript.&amp;nbsp;
Honestly, I didn’t find the topic that engaging, which combined with an
apparently nervous presenter, meant that I didn’t take that many notes.&amp;nbsp; Check out the website for a video, and &lt;a href="http://javascript.crockford.com/prototypal.html"&gt;http://javascript.crockford.com/prototypal.html&lt;/a&gt;
&amp;nbsp;for more info.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;u&gt;&lt;br /&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;u&gt;Node.js&lt;o:p&gt;&lt;/o:p&gt;&lt;/u&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Jason Huggins (twitter @hugs – formerly @jhuggins) of
SauceLabs (“Selenium in the cloud”) presented an overview of Node.js.&amp;nbsp; This presentation I did find intriguing,
although may be more applicable to my Linux friends than those living in a
Microsoft world. (If you don’t know what POSIX means, you probably won’t want
to use Node.js) &lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Node.js, at a very high level, is a JavaScript environment
that lives outside the browser.&amp;nbsp; Think:
server-side JavaScript or shell-scripting on crack.&amp;nbsp; It’s a three-way marriage with the following actors:&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Common.JS: An attempt at a common/standard
JavaScript library, not tied to any specific framework.&amp;nbsp; Most other high-level languages have some
core library (.Net has – well, the .Net core libs, Perl has CPAN, etc).&amp;nbsp; Includes library support for file access, database
drivers, console drivers, etc. (http://commonjs.org)&lt;/li&gt;
&lt;li&gt;Google’s V8 JavaScript engine: This is the JS
engine in Chrome – written in C++, it’s very powerful, very fast, but really
not a standalone system – intended to be run from within a browser.&lt;/li&gt;
&lt;li&gt;Node.js: The glue that holds it all together.
Provides a command line interpreter in addition to the JavaScript run-time
environment.&amp;nbsp; Adds additional libraries
to round-out common.js. (&lt;a href="http://nodejs.org/"&gt;http://nodejs.org&lt;/a&gt;)&lt;/li&gt;
&lt;/ul&gt;
&lt;br /&gt;
&lt;div class="MsoNormal"&gt;
Node.js is fairly new to the scene – started circa Nov 2009.
It requires a POSIX environment, which means additional installs in
Windows-land if you want to use it. Use out-of-the-box for Linux and friends.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Per the presenter, search Google for “node.js jsconf slides”
for the originators presentation slides, which go into depth about the project.
(You can also find video of this slide presentation with audio overlay at &lt;a href="http://blip.tv/file/3152542"&gt;http://blip.tv/file/3152542&lt;/a&gt; or just this
presenter’s slides at &lt;a href="http://www.slideshare.net/hugs/nodejs-javascript-chicago-meetup"&gt;http://www.slideshare.net/hugs/nodejs-javascript-chicago-meetup&lt;/a&gt;
)&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
So what’s so great about using JavaScript outside a
browser?&amp;nbsp; Well, unlike most other
scripting languages, JavaScript is (can be) event-driven – meaning you can
provide anonymous functions to method calls to create async callbacks when
handling results, providing a more responsive and scalable system, as well as
being a feature-rich language:&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; db.query($sql,
function(result) {&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; //do
something with result&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
The framework provides library inheritance (like the “using”
keyword in C#, #include in C).&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var sys
= require(“sys”);&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var
http = require(“http”);&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; http.createServer(…);&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
The presenter’s proof-of-concept demo was a ~20 line
JavaScript application that bound itself to a port as an http listener and
responded with an HTTP 200 request and “Hello World” body to any incoming
request.&amp;nbsp; Could be very useful for
mocking up web interfaces.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
Some drawbacks:&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo2; text-indent: -.25in;"&gt;
-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Library is new and immature – but appears to be
growing up quickly.&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="margin-left: .75in; mso-add-space: auto; mso-list: l1 level1 lfo2; text-indent: -.25in;"&gt;
-&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;Currently no “step debugging” support – start
loving log output now &lt;span style="font-family: Wingdings;"&gt;L&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;u&gt;Other notes:&lt;/u&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
The presenter is a founder of SauceLabs (&lt;a href="http://saucelab.com/"&gt;http://saucelab.com&lt;/a&gt;), which provides cloud-based
support for the UI testing framework Selenium (&lt;a href="http://seleniumhq.org/"&gt;http://seleniumhq.org/&lt;/a&gt;).&amp;nbsp; I’ve been wanting to play with Selenium, and
if/when I do, this looks like an interesting model for grid-based/pay-as-you-go
script agents.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;Lightning Talks:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;ul&gt;
&lt;li&gt;Chad Norwood presented his JavaScript-based
project for using Google Maps as a filter for large, geography-based data
sets.&amp;nbsp; Specifically, he’s linked Google
Maps and Google Calendar to allow the user to display/filter calendar entries
by physical location.&amp;nbsp; In his example, he
used a usergroup calendar (such as &lt;a href="http://chicagotechcal.com/"&gt;http://chicagotechcal.com&lt;/a&gt;
– love it!) and could zoom in/out to narrow/widen the list of events and chart
them on the map. Cool idea.&amp;nbsp; Play with it
here: &lt;a href="http://chadnorwood.com/gcm"&gt;http://chadnorwood.com/gcm&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://chadnorwood.com/gcm"&gt;&lt;/a&gt;The second talk was kind of a teaser for another
presentation at a local Ruby group. MongoDB is a JSON-based database
(apparently similar to CouchDB) which stores data as BSON (Binary JSON). Its
schema-less, so stores the objects as you define them. I could see this useful
for cases where you may want to cache AJAX responses for improved performance,
but I struggle to see where/how you would use this in an enterprise environment
(full disclosure: I’m a big fan of RDBMS, so you’d have to really wow me to
move away from a relational design).&amp;nbsp;
More can be found here:&amp;nbsp; &lt;a href="http://mongo.kylebanker.com/"&gt;http://mongo.kylebanker.com&lt;/a&gt;&lt;div class="MsoListParagraphCxSpFirst" style="mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;

&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
That’s all for tonight.&amp;nbsp;
Typically, after the meeting a smaller group goes to the Elephant and
Castle pub for drinks and networking – but after a long week, and a list of
must-do’s for the client status meeting the next morning, I opted instead to
head home.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;Bonus Teaser:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
I’m working on a blog (rather, the code which will lead to a
blog) as an intro to Microsoft’s ASP.NET Charting controls and Google’s .NET
Analytics API.&amp;nbsp; Think: Building your own
custom Google Analytics charts.&amp;nbsp; Why?
Because I want to see them on my Flash-less iPhone. And ‘cuz I’m a geek.&lt;/div&gt;
&lt;div class="MsoNormal"&gt;
&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-1991867797187788602?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/V7gxb3iw0RFM8y4QpLNhSZr3l6g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/V7gxb3iw0RFM8y4QpLNhSZr3l6g/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/V7gxb3iw0RFM8y4QpLNhSZr3l6g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/V7gxb3iw0RFM8y4QpLNhSZr3l6g/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uo3UJdUNGF8:w6W-4s6l8y8:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=uo3UJdUNGF8:w6W-4s6l8y8:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uo3UJdUNGF8:w6W-4s6l8y8:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uo3UJdUNGF8:w6W-4s6l8y8:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uo3UJdUNGF8:w6W-4s6l8y8:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=uo3UJdUNGF8:w6W-4s6l8y8:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/uo3UJdUNGF8" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2010/02/nodejs-et-al-highlights-from-javascript.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/1991867797187788602?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/1991867797187788602?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/uo3UJdUNGF8/nodejs-et-al-highlights-from-javascript.html" title="Node.js, et al: Highlights from JavaScript Chicago January Meeting" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2010/02/nodejs-et-al-highlights-from-javascript.html</feedburner:origLink></entry><entry gd:etag="W/&quot;A04NQng6cSp7ImA9WxBQGUg.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-5184738863659921805</id><published>2010-01-19T21:59:00.000-06:00</published><updated>2010-01-19T21:59:53.619-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-19T21:59:53.619-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="UserGroups" /><title>Dependency Injections and Inversion of Control Containers -- Chicago Architects Group January Meeting Recap</title><content type="html">&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;em&gt;&lt;span style="color: black; font-family: &amp;quot;Arial&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 10.0pt;"&gt;(Each month I plan to attend
technical user groups in the Chicago area to (re-)learn from peers experiences
with new and existing technologies and to network with like-minded techies.
This blog is one in a series of recaps of some of the more interesting aspects
of the meetings for my own purposes (this is a “web log” afterall) and for
others to get a general taste of what’s available in the Chicago user group
scene.)&lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/em&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;User
Group:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;
Chicago Architects Group&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 27.0pt; margin-right: 0in; margin-top: 0in;"&gt;
&lt;a href="http://www.chicagoarchitectsgroup.com/"&gt;&lt;span style="mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: major-fareast;"&gt;http://www.chicagoarchitectsgroup.com/&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 27.0pt; margin-right: 0in; margin-top: 0in;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;Location:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt; ITA (200 S Wacker
- next to Sears Tower)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 27.0pt; margin-right: 0in; margin-top: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;Meeting
Date:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;
Tuesday, January 19th, 2010&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;The CAG meetings I’ve been to have had
between 10 and 20 attendees and tend to be more of the Architect/Team Lead
types and less of the hard-core, in your face techies/developers (this is not a
bad thing, in my opinion). Like most user groups, they have pizza and soda as
well as giveaways at the end (today included Windows 7 Ultimate, Office 2007, a
wireless mouse and several books).&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;
&lt;/span&gt;Personally, I find the meetings to be useful, although I know some of my
coworkers who have come with me will likely not attend unless the topics are of
great personal interest to them.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;Presenter:&lt;/span&gt;&lt;/u&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt; Tim Murphy&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 27.0pt; margin-right: 0in; margin-top: 0in;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;Blog: &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;&lt;a href="http://geekswithblogs.net/tmurphy"&gt;http://geekswithblogs.net/tmurphy&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 27.0pt; margin-right: 0in; margin-top: 0in;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;Twitter: @&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;twmurph&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;Topic:
&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;Dependency
Injection and IOC Containers&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;I'll admit up front that this entry will be
a little light on content, such as the pros/cons to using this pattern – mainly
I’m making notes for me to reference later. Here is a link to the presenter’s wrap-up
as well, with slides and code (using Unity and Windsor). &lt;/span&gt;&lt;a href="http://geekswithblogs.net/tmurphy/archive/2010/01/19/cag-january-2010-wrap-up.aspx"&gt;&lt;span style="mso-fareast-font-family: &amp;quot;Times New Roman&amp;quot;; mso-fareast-theme-font: major-fareast;"&gt;http://geekswithblogs.net/tmurphy/archive/2010/01/19/cag-january-2010-wrap-up.aspx&lt;/span&gt;&lt;/a&gt;&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;But by all means, please read on :-)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;The Dependency Injection pattern is
intended to lessen the coupling of objects by having dependant objects provided
to an object instead of having the object itself generate the dependant
objects. For example, you have a Widget object which depends upon a
LoggingManager object and a WidgetValidator object.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Without Dependency Injection, you might instantiate
your dependant objects insider your object constructor, like this:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;namespace&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt; WrightThisBlog.blogspot.com&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MainApp&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&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;object&lt;/span&gt;[]
argv, &lt;span style="color: blue;"&gt;int&lt;/span&gt; argc)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; myWidget = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Widget&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//do some widgetity stuff here&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;interface&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IWidget&lt;/span&gt; {}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;interface&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ILogger&lt;/span&gt; { }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;interface&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IValidator&lt;/span&gt; { }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;LoggingManager&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;ILogger&lt;/span&gt;
{ }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;WidgetValidator&lt;/span&gt; : &lt;span style="color: #2b91af;"&gt;IValidator&lt;/span&gt;
{ }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;Widget&lt;/span&gt;: &lt;span style="color: #2b91af;"&gt;IWidget&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;ILogger&lt;/span&gt; _logger;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;IValidator&lt;/span&gt; _validator;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; Widget()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_logger = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;LoggingManager&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;_validator
= &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;WidgetValidator&lt;/span&gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;But now you're tied to a specific implementation
of ILogger and IValidator and if you ever wanted to change them, you'd have to
modify your code anywhere you referenced those objects and replace them with
your new ILogger object.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This is less
than ideal and makes your code a bit fragile.&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;span style="font-family: &amp;quot;Calibri&amp;quot;,&amp;quot;sans-serif&amp;quot;; font-size: 11.0pt;"&gt;&amp;nbsp;So how does Dependency Injection
change this?&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Basically, by having the
caller provide the ILogger and IValidator to the Widget object, either as
parameters in the constructor or as properties. This is further decoupled in my
example by using factory classes:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;namespace&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt; WrightThisBlog.blogspot.com&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MainApp2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&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;object&lt;/span&gt;[]
argv, &lt;span style="color: blue;"&gt;int&lt;/span&gt; argc)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;IWidget&lt;/span&gt; myWidget = &lt;span style="color: #2b91af;"&gt;WidgetFactory&lt;/span&gt;.GetWidgetInstanceViaConstructor();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;IWidget&lt;/span&gt; myNextWidget = &lt;span style="color: #2b91af;"&gt;WidgetFactory&lt;/span&gt;.GetWidgetInstanceViaProperties();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//do some widgetity stuff here&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ImprovedWidget&lt;/span&gt;: &lt;span style="color: #2b91af;"&gt;IWidget&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; ImprovedWidget(&lt;span style="color: #2b91af;"&gt;ILogger&lt;/span&gt;
loggerToUse, &lt;span style="color: #2b91af;"&gt;IValidator&lt;/span&gt; validatorToUse)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;LoggerToUse
= loggerToUse;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;ValidatorToUse = validatorToUse;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; ImprovedWidget() {}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ILogger&lt;/span&gt;
LoggerToUse { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;;
}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IValidator&lt;/span&gt;
ValidatorToUse { &lt;span style="color: blue;"&gt;get&lt;/span&gt;; &lt;span style="color: blue;"&gt;set&lt;/span&gt;;
}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;WidgetFactory&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Could provide in
constructor&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IWidget&lt;/span&gt; GetWidgetInstanceViaConstructor()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;ILogger&lt;/span&gt; logger = &lt;span style="color: #2b91af;"&gt;LoggerManagerFactory&lt;/span&gt;.GetLoggerInstance();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;IValidator&lt;/span&gt; validator = &lt;span style="color: #2b91af;"&gt;WidgetValidatorFactory&lt;/span&gt;.GetValidatorInstance();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ImprovedWidget&lt;/span&gt;(logger, validator);&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;summary&amp;gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; Or via properties
(beware unset properites!)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;span style="color: grey;"&gt;///&lt;/span&gt;&lt;span style="color: green;"&gt; &lt;/span&gt;&lt;span style="color: grey;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span style="color: green;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IWidget&lt;/span&gt; GetWidgetInstanceViaProperties()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ImprovedWidget&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;LoggerToUse = &lt;span style="color: #2b91af;"&gt;LoggerManagerFactory&lt;/span&gt;.GetLoggerInstance(),&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;ValidatorToUse = &lt;span style="color: #2b91af;"&gt;WidgetValidatorFactory&lt;/span&gt;.GetValidatorInstance()&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;};&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;LoggerManagerFactory&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;ILogger&lt;/span&gt; GetLoggerInstance() { &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;LoggingManager&lt;/span&gt;(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;WidgetValidatorFactory&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;IValidator&lt;/span&gt; GetValidatorInstance() { &lt;span style="color: blue;"&gt;return&lt;/span&gt; &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;WidgetValidator&lt;/span&gt;(); }&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
Now you’ve created a
loose coupling between your Widget and its supporting objects, which will come
in handy when&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;You want to use a mocking tool (like RhinoMocks)
to unit test your code&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;You want to replace your LoggingManager with
something else that implements ILogger – now you only need to update the
factory classes (technically, using a factory class is a different pattern, but
works well here)&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
Still, you’re coding in
a concrete implementation in your factory, so while you’ve isolated the number
of places you need to update, you’re still hard-coding in an
implementation.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Additionally, if there
are very deep dependencies (you’re Logger needs a FileManager which needs a
PermissionsManager which needs a CurrentUserManager….), this can get pretty
ugly to manage and you end up writing a lot of plumbing code that is only
tangential to the application’s real purpose.&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
This is where the IOC
Containers come into play.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Using an IOC
framework, you define which concrete classes implement your interfaces and what
dependencies they have.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Then you use the
IOC container like a factory class to instantiate your objects.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;There are two primary means for defining the
dependency trees: using XML in your app.config or via code.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;Per the group discussions, some IOC
frameworks provide tools (such as Structure Map) which will auto-generate your
code mappings, while others (like Microsoft’s Unity Framework) use [Dependency]
attributes to denote where there are dependencies.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp; &lt;/span&gt;This allows you to say “I need an IWidget”
and the container framework will know that ImprovedWidget should be created and
it has dependences on ILogger and IValidator, which are provided by LoggerMananger
and WidgetValidator, and so on.&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;using&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt; Some.IOC.Framework;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="color: blue; font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;namespace&lt;/span&gt;&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt; WrightThisBlog.blogspot.com&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;{&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&lt;/span&gt; &lt;span style="color: blue;"&gt;static&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MainApp3&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;public&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;object&lt;/span&gt;[]
argv, &lt;span style="color: blue;"&gt;int&lt;/span&gt; argc)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;{&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: blue;"&gt;var&lt;/span&gt; IOC_container = IOC_Framework.GetContainer();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: #2b91af;"&gt;IWidget&lt;/span&gt; myWidget = IOC_container.GetObject&amp;lt;&lt;span style="color: #2b91af;"&gt;IWidget&lt;/span&gt;&amp;gt;();&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color: green;"&gt;//do some widgetity stuff here&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; font-size: 10.0pt; mso-no-proof: yes;"&gt;}&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;h2&gt;
&lt;span style="mso-no-proof: yes;"&gt;Resources and Reference:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/h2&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="mso-bidi-font-family: &amp;quot;Courier New&amp;quot;; mso-no-proof: yes;"&gt;Some
IOC Frameworks:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Structure Map &lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level2 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; mso-fareast-font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Has
“scanning” tool to auto-map dependencies and limit the amount of manual
configuration needed. (If only one class in your project implements a given
interface, that class will be used when that interface is requested).&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Ninject&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Castle Windsor&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level2 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; mso-fareast-font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Uses
app.config to defined assemblies/classes to use for each interface.&lt;span style="mso-spacerun: yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;Uses constructor to provide dependencies.&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Microsoft Unity (part of P &amp;amp; P group)&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 1.0in; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level2 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: &amp;quot;Courier New&amp;quot;; mso-fareast-font-family: &amp;quot;Courier New&amp;quot;;"&gt;&lt;span style="mso-list: Ignore;"&gt;o&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Uses
[Dependency] attributes places on class properties to determine where
dependencies are needed, as well as to get/set them.&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-layout-grid-align: none; text-autospace: none;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;Some links:&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;Martin Fowler: &lt;a href="http://martinfowler.com/articles/injection.html"&gt;http://martinfowler.com/articles/injection.html&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;MSDN article on DI: &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc163739.aspx"&gt;http://msdn.microsoft.com/en-us/magazine/cc163739.aspx&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto; mso-layout-grid-align: none; mso-list: l0 level1 lfo1; text-autospace: none; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol; mso-bidi-font-family: Symbol; mso-fareast-font-family: Symbol;"&gt;&lt;span style="mso-list: Ignore;"&gt;·&lt;span style="font: 7.0pt &amp;quot;Times New Roman&amp;quot;;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;DI Tutorial: &lt;a href="http://tutorials.jenkov.com/dependency-injection/index.html"&gt;http://tutorials.jenkov.com/dependency-injection/index.html&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;
&lt;script charset="utf-8" expr:src="&amp;quot;http://feeds.feedburner.com/~s/WrightThisBlog?i=&amp;quot; + data:post.url" type="text/javascript"&gt;
&lt;/script&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-5184738863659921805?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/36MLGpQkHXEbsCgD3gg5-r44rac/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/36MLGpQkHXEbsCgD3gg5-r44rac/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/36MLGpQkHXEbsCgD3gg5-r44rac/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/36MLGpQkHXEbsCgD3gg5-r44rac/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Q-HAFhEjwZo:ZFq8rfn5Wwc:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=Q-HAFhEjwZo:ZFq8rfn5Wwc:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Q-HAFhEjwZo:ZFq8rfn5Wwc:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Q-HAFhEjwZo:ZFq8rfn5Wwc:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Q-HAFhEjwZo:ZFq8rfn5Wwc:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=Q-HAFhEjwZo:ZFq8rfn5Wwc:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/Q-HAFhEjwZo" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2010/01/dependency-injections-and-inversion-of.html#comment-form" title="0 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/5184738863659921805?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/5184738863659921805?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/Q-HAFhEjwZo/dependency-injections-and-inversion-of.html" title="Dependency Injections and Inversion of Control Containers -- Chicago Architects Group January Meeting Recap" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>0</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2010/01/dependency-injections-and-inversion-of.html</feedburner:origLink></entry><entry gd:etag="W/&quot;CEEHRXc_eSp7ImA9WhZTGEk.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-3500576731157255662</id><published>2010-01-13T23:50:00.002-06:00</published><updated>2011-03-22T20:10:34.941-05:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2011-03-22T20:10:34.941-05:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="UserGroups" /><title>CQRS Overview - Chicago Alt.Net User Group January Meeting Recap</title><content type="html">&lt;div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;
&lt;span class="Apple-style-span" style="font-size: x-small;"&gt;&lt;i&gt;&lt;span class="Apple-style-span" style="font-size: small; font-style: normal;"&gt;&lt;em&gt;&lt;span style="font-size: x-small;"&gt;(Each month I plan to attend technical user groups in the Chicago area to (re-)learn from peers experiences with new and existing technologies and to network with like-minded techies. This blog is one in a series of recaps of some of the more interesting aspects of the meetings for my own purposes (this is a “web log” afterall) and for others to get a general taste of what’s available in the Chicago user group scene.)&lt;/span&gt;&lt;/em&gt;&lt;/span&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;u&gt;UserGroup:&lt;/u&gt;&amp;nbsp;Chicago Alt.Net &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;"&gt;
&lt;span style="font-family: inherit;"&gt;&lt;a href="http://chicagoalt.net/"&gt;http://chicagoalt.net/&lt;/a&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in; text-indent: .5in;"&gt;
&lt;span style="font-family: inherit;"&gt;Location: Willis (aka Sears) Tower&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;&lt;u&gt;Meeting Date:&lt;/u&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: inherit;"&gt;Wednesday, January 13, 2010&lt;/span&gt;&lt;span class="Apple-style-span" style="color: black; font-size: medium;"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div style="margin-bottom: .0001pt; margin: 0in;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;If you're in the Chicagoland area
and do any .Net programming, I recommend this group.&amp;nbsp; It's got a decent
turnout (usually). I've been to three meetings with anywhere from 20 - 40
people in attendance.&amp;nbsp; And they have good giveaways if you stay till the
end. Today was especially good: A copy of Windows7 Ultimate, Office 2007, the JetBrain's
product of your choice (ReSharper, dotTrace, TeamCity, IntelleJ -- great
products if you're not familiar), $50 Barnes &amp;amp; Noble card, and of course a
few Microsoft tech books. And free pizza!&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;Presenter:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;
John Nuechterlein (aka Jdn) (&lt;a href="http://www.blogcoward.com/"&gt;http://www.blogcoward.com&lt;/a&gt;).&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto;"&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;Topic:&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt; CQRS in
roughly an hour or so&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: .5in;"&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;(CQRS ==
"Command Query Responsibility Segregation")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; mso-margin-bottom-alt: auto; mso-margin-top-alt: auto; text-indent: .5in;"&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in;"&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;So, I'll be honest: Going into this
presentation, I had only a very vague idea of what CQRS is and even less idea
why I should care. (I had actually planned to play poker that night instead,
but poker got canceled &lt;/span&gt;&lt;span style="font-family: Wingdings; font-size: 13pt;"&gt;L&lt;/span&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;).&amp;nbsp;
Leaving this presentation, my mind was swirling with all of the projects where
CQRS would have been great to use (and the many parallels with the
"massively" distributed computing environment we developed at
Wayport.&amp;nbsp; -- where "massive" is defined in pre-Google,
pre-Facebook terms).&lt;br /&gt;
&lt;br /&gt;
So, what is CQRS?&amp;nbsp; Frankly, I couldn't do it justice in this blog -- but I
needn’t try, since my smarter, more eloquent people have done so before me.
Actually, from what I understand, CQRS got its start in the blogosphere. For
more depth, here is one key link (&lt;/span&gt;&lt;a href="http://elegantcode.com/2009/11/11/cqrs-la-greg-young/"&gt;http://elegantcode.com/2009/11/11/cqrs-la-greg-young/&lt;/a&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;), but here's my lame attempt at a quick definition:&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: .5in; margin-right: 0in; margin-top: 0in;"&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;&lt;br /&gt;
&lt;i style="mso-bidi-font-style: normal;"&gt;CQRS is a system architecture/design
pattern that separates the act of reading data (query) from taking action
(command) in order to produce a system which easily scales and provides some
useful benefits (such as "playable" event logs) that make the
maintenance of the system less burdensome. (For my purposes, I'm going to
designate CQRS as an "architecture", partly because I don't want to
write "architecture/design pattern" anymore.)&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpFirst" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; mso-add-space: auto;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;&lt;br /&gt;
In my mind, CQRS lends itself pretty well to web-based systems, and SOA/SaaS at
that, although it could be applied elsewhere.&amp;nbsp; I'm probably jumping ahead
of myself a bit, but that statement is useful for backing this next statement.
To consider using CQRS, you must buy into a fundamental assertion: your data is
always stale.&amp;nbsp; How stale depends on your system, but the fact that &lt;a href="http://wrightthisblog.blogspot.com/2010/01/net-knowledge-nuggets-data-caching.html"&gt;my
last blog entry&lt;/a&gt; was about data caching techniques just goes to show that
particularly in web-based system, we intentionally make some of our data stale
by putting it into a cache.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;a href="http://elegantcode.com/wp-content/uploads/2009/11/DDDDevision_big_thumb.jpg" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://elegantcode.com/wp-content/uploads/2009/11/DDDDevision_big_thumb.jpg" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class="separator" style="clear: both; text-align: center;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;But
even without intentional caching, your data is stale.&amp;nbsp; Consider this: you
have an eCommere site (say, amazon.com). Your end user pulls up the product
page for the Widget2010 product, which includes price and quantity in stock information.
In the 60 seconds it takes the user to read the page and click the shopping
cart button, five other people have ordered their own Widget2010, so the
quantity in stock is now less than what's on the first user's screen -- thus,
the data is stale.&amp;nbsp; You know this -- you expect this -- and you've already
coded a dozen ways to deal with this, so accepting that "your data is
always stale" is really not that big a leap of faith.&lt;br /&gt;
&lt;br /&gt;
So why is that important?&amp;nbsp; Because the CQRS architecture separates the
reading of data and the acting upon data into two separate logical areas, where
the reading area has a data cache which is stale.&amp;nbsp; Now, it may only be 1
ms stale, but stale none the less.&lt;br /&gt;
&lt;br /&gt;
So let's dive in to my high level summary of Jdn's high level overview. (note:
if you want to bypass my bias and possibly complete misinterpretation of the
presentation, it is (or will soon be) available on the &lt;a href="http://chicagoalt.net/"&gt;http://chicagoalt.net&lt;/a&gt; website in video form):&lt;br /&gt;
&lt;br /&gt;
CQRS has four logic areas in your system design, as pictured in this drawing
stolen squarely from the blog linked above:&lt;br /&gt;
&lt;/span&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;Queries&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
This is the "reporting" piece -- or said another way, this is the
read-only interface into your data. Basically, it's a lightweight data layer
reading from your data store and proving DTOs back to your UI. It does &lt;b style="mso-bidi-font-weight: normal;"&gt;NOT&lt;/b&gt; go through your Domain Model.&amp;nbsp;
It is simply a read-only view into your database.&amp;nbsp; Your database, however,
is really a cache of your data, and likely a local cache.&amp;nbsp; In other words,
since the data is just a cache of the "real" data, why not push it
out as close to the UI as possible to minimize the latency to your UI (since
the majority of your UI's interactions with your data is reading, making this link
super-fast will in turn make your system faster). Since these are read-only
views into your data, the DTOs are extremely simple and can/should be specific
to the consumer (ie: no "product" DTO, but rather a
productForOrderPage which only has the data needed by the order page) reducing
the amount of data getting dragged around between layers, etc.&amp;nbsp; Why pull
your full product from the db if you only need 20% of the information for the
current page? Need to scale your UI? Just add another data store/cache -- it's
practically a rubber stamp.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;Commands&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
The next logical area of this architecture is the Command Bus/Command Handlers.
This is where the next tenant of CQRS comes into play: system actions (aka
"commands") have specific intent.&amp;nbsp; If you've practiced Agile
Development and you're familiar with the concept of the User Story -- basically
requirements as documented from the viewpoint of a user's interaction with the
system -- then this may be easy to grasp.&amp;nbsp; Basically, Commands are actions
taken on your Domain objects.&amp;nbsp; For example: CustomerChangedAddressCommand
or AddProductToShoppingCartCommand.&lt;br /&gt;
&lt;br /&gt;
Commands are the only way to update data in your system and are seen as atomic
actions which can be wholly accepted or rejected. Commands are generated by the
UI and pushed onto the Command Bus and picked up by Command Handlers.&amp;nbsp;
Command Handlers in turn pass those commands into the Domain.&amp;nbsp; Since
commands go onto a bus, they can be queued, prioritized, etc, just like any message
on a messaging bus, thus allowing you to ensure your most important commands
are handled appropriately (another scalability knob you can adjust to meet your
performance needs).&lt;br /&gt;
&lt;br /&gt;
Now, since commands require specific intent (ie: user updates their address/places
item into shopping cart), this does have implications for your UI --
specifically, you can't have "Excel-like screens".&amp;nbsp; There's no
"update everything about this user and here's all the data" command
(or there shouldn't be), so if that's what you're looking for, you may want to
look elsewhere.&amp;nbsp; But honestly, this may not be a bad thing, as it forces
some system designs which will likely result in more user friendly, reliable
systems in the long run.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;Internal Events / Domain&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
This area is the authoritative knowledge source.&amp;nbsp; Your business logic
resides here. Your Domain objects reside here.&amp;nbsp; Here is where you'll find
the Event Store. This is the most complicated part of the system, and is where
the presenter struggled at times to explain some concepts / answer some
questions, so this is where you'll likely want to ensure you've done your
homework. (To his credit, Jdn fully admitted up front he did not know all of
the ins-and-outs of this area and did his best to explain).&lt;br /&gt;
&lt;br /&gt;
As commands come into your Domain from the Command Handlers, your Domain
objects validate business rules to determine if the command is valid for the current
state of the world and either reject the command en-whole, or, in one atomic
action, update the state of the world according to the command (thus, an “event”
occurs).&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;Events
are written to the Event Store, which is persisted, likely in an RDBMS, ODBMS,
etc.&amp;nbsp; A snapshot of the state of the world is taken periodically and if
you want to recreate a place-in-time, just take the previous snapshot and
replay the events in order from that snapshot until the place-in-time you care
about. Your domain could just remain in memory, if you'd like -- otherwise
you'd pull the most recently stored (via snapshot) version of your domain
object(s) and replay any new events against that object until it's fully
restored, then execute your new command and presto-chango!&lt;br /&gt;
&lt;br /&gt;
Now this was of particular interest to me from a troubleshooting/audit
standpoint.&amp;nbsp; If a problem occurs on the site, pick a snapshot from right
before the problem occurred and replay your events to reproduce the issue. (QA
engineers applaud here.)&amp;nbsp; New version deployment go ghastly wrong,
rollback the events until right before the deployment.&amp;nbsp; Theoretically, you
could even re-run the events again against the older version of the software
and (unless the events weren't supported in that version) recover the data
changes.&amp;nbsp; Try doing that when your domain is specific to your db schema or
your audit history is at the db table level (how do you replay an
"insert" when the columns have changed?)&lt;br /&gt;
&lt;br /&gt;
One note here is that your Event Store is "write only" -- meaning you
don't ever delete things from your domain, you just adjust them.&amp;nbsp; The
presenter used the analogy of an accountant ("accountants don't use
erasers").&amp;nbsp; If an accountant finds an error in the ledgers, they
don't edit that line item -- instead they create an adjustment line item to
offset the difference.&amp;nbsp; The Event Store is similar -- you create events to
adjust/negate/otherwise manipulate your data.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;External Events / Publication&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
Now, to go full circle, the Domain / Event handling system will publish any
events that it handles (but not those that it rejects).&amp;nbsp; Any data
stores/caches will subscribe to that feed, and will update themselves based on
those events. Thus, your data cache is only as stale as it takes to process the
published events.&amp;nbsp; Again, you use a message bus here (or a webservice,
etc) and use prioritization queues if you wish to enhance
performance/scalability. &lt;br /&gt;
&lt;br /&gt;
This is where the concept of "Eventual Consistency" is used -- that
is, your Domain and your Data Stores will eventually sync up, just not necessarily
in "real time" -- but we're ok with that because we've agreed that
latency is almost always ok and availability trumps correctness in the Data
Stores -- because "your data is always stale" anyway.&lt;br /&gt;
&lt;br /&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;And the big finish...&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
To conclude, the presenter touched on reasons why you wouldn't want to use CQRS,
including:&lt;br style="mso-special-character: line-break;" /&gt;
&lt;br style="mso-special-character: line-break;" /&gt;
&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 38.25pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol;"&gt;·&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;it's new, it's different&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 38.25pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol;"&gt;·&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;multiple data stores (maybe you
don't want this)&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 38.25pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol;"&gt;·&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;operational complexity&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpMiddle" style="line-height: normal; margin-bottom: .0001pt; margin-bottom: 0in; margin-left: 38.25pt; margin-right: 0in; margin-top: 0in; mso-add-space: auto; mso-list: l0 level1 lfo1; text-indent: -.25in;"&gt;
&lt;span style="font-family: Symbol;"&gt;·&lt;span style="font: normal normal normal 7pt/normal 'Times New Roman';"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&lt;/span&gt;&lt;/span&gt;&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;lots of commands, events, handles,
etc&lt;/span&gt;&lt;/div&gt;
&lt;div class="MsoListParagraphCxSpLast" style="line-height: normal; margin-bottom: .0001pt; margin: 0in; mso-add-space: auto;"&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: 13pt;"&gt;&lt;br /&gt;
&lt;b style="mso-bidi-font-weight: normal;"&gt;&lt;u&gt;…and my conclusion&lt;/u&gt;&lt;/b&gt;&lt;br /&gt;
All-in-all, this is definitely something I will consider for large systems in
the future, although it is likely overkill for most systems in the market I
serve.&amp;nbsp; I suggest doing some Google searches if you're interested at all
in learning more (seems to be a good deal of data, videos, webinars, blogs,
etc. out there).&lt;/span&gt;&lt;/div&gt;
&lt;span style="font-family: 'Times New Roman', serif; font-size: large;"&gt;&lt;span style="font-size: 17px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;script charset="utf-8" expr:src="&amp;quot;http://feeds.feedburner.com/~s/WrightThisBlog?i=&amp;quot; + data:post.url" type="text/javascript"&gt;
&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;---
This posting originated from &lt;a href="http://WrightThisBlog.blogspot.com/"&gt;http://WrightThisBlog.blogspot.com/&lt;/a&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/667102039313110441-3500576731157255662?l=wrightthisblog.blogspot.com' alt='' /&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/ppFOeIBdpRrGzJWTIuVIaeViuws/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ppFOeIBdpRrGzJWTIuVIaeViuws/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/ppFOeIBdpRrGzJWTIuVIaeViuws/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/ppFOeIBdpRrGzJWTIuVIaeViuws/1/di" border="0" ismap="true"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/p&gt;&lt;div class="feedflare"&gt;
&lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=v71ImokIkpE:lLXMfQXEeLI:4cEx4HpKnUU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?i=v71ImokIkpE:lLXMfQXEeLI:4cEx4HpKnUU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=v71ImokIkpE:lLXMfQXEeLI:yIl2AUoC8zA"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=yIl2AUoC8zA" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=v71ImokIkpE:lLXMfQXEeLI:qj6IDK7rITs"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=qj6IDK7rITs" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=v71ImokIkpE:lLXMfQXEeLI:bcOpcFrp8Mo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=bcOpcFrp8Mo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.feedburner.com/~ff/WrightThisBlog?a=v71ImokIkpE:lLXMfQXEeLI:I9og5sOYxJI"&gt;&lt;img src="http://feeds.feedburner.com/~ff/WrightThisBlog?d=I9og5sOYxJI" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/WrightThisBlog/~4/v71ImokIkpE" height="1" width="1"/&gt;</content><link rel="replies" type="text/html" href="http://wrightthisblog.blogspot.com/2010/01/cqrs-overview-chicago-altnet-user-group.html#comment-form" title="1 Comments" /><link rel="edit" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/3500576731157255662?v=2" /><link rel="self" type="application/atom+xml" href="http://www.blogger.com/feeds/667102039313110441/posts/default/3500576731157255662?v=2" /><link rel="alternate" type="text/html" href="http://feedproxy.google.com/~r/WrightThisBlog/~3/v71ImokIkpE/cqrs-overview-chicago-altnet-user-group.html" title="CQRS Overview - Chicago Alt.Net User Group January Meeting Recap" /><author><name>John M. Wright</name><uri>http://www.blogger.com/profile/01686944001641865712</uri><email>noreply@blogger.com</email><gd:image rel="http://schemas.google.com/g/2005#thumbnail" width="30" height="32" src="http://1.bp.blogspot.com/-vroGvdmXdG8/TwI6iOZIdMI/AAAAAAAAAQU/gU5eQkzqcxU/s220/kumas.jpg" /></author><thr:total>1</thr:total><feedburner:origLink>http://wrightthisblog.blogspot.com/2010/01/cqrs-overview-chicago-altnet-user-group.html</feedburner:origLink></entry><entry gd:etag="W/&quot;DkANRHc7fip7ImA9WxBRGE4.&quot;"><id>tag:blogger.com,1999:blog-667102039313110441.post-468810403908587360</id><published>2010-01-06T21:24:00.001-06:00</published><updated>2010-01-06T21:26:35.906-06:00</updated><app:edited xmlns:app="http://www.w3.org/2007/app">2010-01-06T21:26:35.906-06:00</app:edited><category scheme="http://www.blogger.com/atom/ns#" term="TipsAndTricks" /><title>.Net Knowledge Nuggets: Data Caching</title><content type="html">When writing ASP.Net applications, you often have a want/need to cache data in the UI layer for reuse. Often this is used to improve performance (limit repeated database calls, for example) or store process state. Below is an overview of various ways to achieve this for various scenarios. &lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 14pt; text-decoration: underline;"&gt;Executive Summary: &lt;/span&gt;&lt;/span&gt;&lt;span mso-bidi-font-family:?times="" new="" roman?;mso-hansi-font-family:calibri;="" roman??="" style="font-size: 10pt; mso-ascii-font-family: Calibri;" times=""&gt;(ordered from shortest to longest typical duration)&lt;/span&gt;&lt;span mso-bidi-font-family:?times="" new="" roman?;mso-hansi-font-family:calibri;="" roman??="" style="font-size: 12pt; mso-ascii-font-family: Calibri;" times=""&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;table border="1" cellpadding="0" cellspacing="0" class="MsoNormalTable" style="border-bottom: medium none; border-collapse: collapse; border-left: medium none; border-right: medium none; border-top: medium none; margin-left: 5.35pt; mso-border-alt: solid #A3A3A3 1.0pt; mso-padding-alt: 0in 0in 0in 0in; mso-yfti-tbllook: 1184;"&gt;&lt;tbody&gt;
&lt;tr style="mso-yfti-firstrow: yes; mso-yfti-irow: 0;"&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: #a3a3a3 1pt solid; border-right: #a3a3a3 1pt solid; border-top: #a3a3a3 1pt solid; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 59.7pt;" valign="top" width="80"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
&lt;span style="font-weight: bold;"&gt;Method &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: #a3a3a3 1pt solid; mso-border-left-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 194.9pt;" valign="top" width="260"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
&lt;span style="font-weight: bold;"&gt;Scope &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: #a3a3a3 1pt solid; mso-border-left-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 103.25pt;" valign="top" width="138"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
&lt;span style="font-weight: bold;"&gt;Lifespan &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: #a3a3a3 1pt solid; mso-border-left-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 420.5pt;" valign="top" width="561"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
&lt;span style="font-weight: bold;"&gt;When to Use &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 1;"&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: #a3a3a3 1pt solid; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 59.7pt;" valign="top" width="80"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
ViewState &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 194.9pt;" valign="top" width="260"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Current page/control and user (each page/control has its own viewstate) &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 103.25pt;" valign="top" width="138"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Across post-back &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 420.5pt;" valign="top" width="561"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
You need to store a value for the current page request and have it retrieved on the next post-back. &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 2;"&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: #a3a3a3 1pt solid; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 59.7pt;" valign="top" width="80"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Base Class &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 194.9pt;" valign="top" width="260"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Current page/user and it's child controls &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 103.25pt;" valign="top" width="138"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Current instance &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 420.5pt;" valign="top" width="561"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
You need to store a value once per page request&amp;nbsp; (such as values from a database) and have access to it during the current page request only &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 3;"&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: #a3a3a3 1pt solid; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 59.7pt;" valign="top" width="80"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
HttpContext &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 194.9pt;" valign="top" width="260"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Current page/user and it's child controls &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 103.25pt;" valign="top" width="138"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Current instance &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 420.5pt;" valign="top" width="561"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
You need to store a value once per page request&amp;nbsp; (such as values from a database) and have access to it during the current page request only &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 4;"&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: #a3a3a3 1pt solid; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 59.7pt;" valign="top" width="80"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
ASP Session &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 194.9pt;" valign="top" width="260"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Site-wide, current user, all pages/controls &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 103.25pt;" valign="top" width="138"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Duration of user's session &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 420.5pt;" valign="top" width="561"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
You need to store a value once per user's visit to the site (such as user profile data) and have access to it from any code for the duration of the user's visit &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 5;"&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: #a3a3a3 1pt solid; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 59.7pt;" valign="top" width="80"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
ASP Cache &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 194.9pt;" valign="top" width="260"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Site-wide, All pages/controls, all users &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 103.25pt;" valign="top" width="138"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Until expires or server restarts &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 420.5pt;" valign="top" width="561"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
You need to store data for access from any code for all users (such as frequently used, but rarely changed, database values -- such as a list of Countries for an address form). &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;tr style="mso-yfti-irow: 6; mso-yfti-lastrow: yes;"&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: #a3a3a3 1pt solid; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 59.7pt;" valign="top" width="80"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Cookies &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 194.9pt;" valign="top" width="260"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Site-wide, current user, all pages/controls &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 103.25pt;" valign="top" width="138"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
Until expires or browser deletes &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;td style="border-bottom: #a3a3a3 1pt solid; border-left: medium none; border-right: #a3a3a3 1pt solid; border-top: medium none; mso-border-left-alt: solid #A3A3A3 1.0pt; mso-border-top-alt: solid #A3A3A3 1.0pt; padding-bottom: 4pt; padding-left: 4pt; padding-right: 4pt; padding-top: 4pt; width: 420.5pt;" valign="top" width="561"&gt;&lt;div class="MsoNormal" style="line-height: normal; margin-bottom: 0pt;"&gt;
You need to store small data (such as user's uniqueId) from one visit to the next, or possibly across sites. Not for sensitive data! &lt;br /&gt;
&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;
&lt;/tbody&gt;&lt;/table&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 14pt; text-decoration: underline;"&gt;ViewState: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
If you’re an ASP.Net developer, you should have a firm grasp of ViewState and all its benefits and drawbacks. Basically, ViewState allows you to store data in a special hidden input field which is provided back to you when the user posts-back the page. This is similar to just using a hidden field, except that it is page-/control-specific (meaning, if you have a user control that is repeated on the page, each instance of the control can store its own ViewState data with the same key and get back its individual results). It also includes some basic security&amp;nbsp; and compression. &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:green?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;// Set ViewState value while rendering the page &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;protected&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;override&lt;/span&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; OnPreRender(&lt;span style="color: #2b91af;"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;base&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt;.OnPreRender(e); &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:green?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;// Set ViewState value &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;this&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt;.ViewState.Add(&lt;span style="color: #a31515;"&gt;"MyComputedValue"&lt;/span&gt;, (&lt;span style="color: #2b91af;"&gt;IList&lt;/span&gt;&amp;lt;MyClass&amp;gt;)BLL.DoSomeComputationThatShouldOnlyRunOnce());&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;//&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; After post-back, retrieve the value&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;protected&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; Page_Load(&lt;span style="color: blue;"&gt;object&lt;/span&gt; sender, &lt;span style="color: #2b91af;"&gt;EventArgs&lt;/span&gt; e) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;IList&amp;lt;MyClass&amp;gt; myValue = (&lt;span style="color: #2b91af;"&gt;IList&lt;/span&gt;&amp;lt;MyClass&amp;gt;)&lt;span style="color: blue;"&gt;this&lt;/span&gt;.ViewState[&lt;span style="color: #a31515;"&gt;"MyComputedValue"&lt;/span&gt;]; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;if&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (myValue == &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 113.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;myValue = BLL.DoSomeComputationThatShouldOnlyRunOnce(); &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
I would discourage the use of ViewState for storing anything more than just very small pieces of data, since this information is included in the rendered HTML and has to be downloaded/uploaded with each request, thus degrading performance. You can configure Viewstate to use Session for it’s storage and eliminate the need to include it in the page’s HTML, but if you’re going that route, why not just use Session directly for your caching location (see below)? &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 14pt; text-decoration: underline;"&gt;BasePage (shared base class): &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
A common pattern I’ve used on just about every project and highly suggest it for many reasons, is to have a "BasePage” class which inherits System.Web.UI.Page, then have all of my application pages inherit from BasePage. This allows the developers to create shared "shortcuts” in one location which are accessible from all of our UI layer code. &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
Among other useful shortcuts (like storing singletons, etc), you can create properties on your BasePage class for storing cached data during the current page invocation. For instance, if you’re using the ASP.Net membership providers, you can store the current authenticated user in your BasePage so that you’re not going to the database everytime you call Membership.GetUser() &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
Note too, that this pattern can be combined with the other patterns listed, such as having a property that reads/writes data from Session, Cookies, etc., allowing for reduced code duplication. &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;using&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; System.Web; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;using&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; System.Web.Security; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;namespace&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; MyProject.WEB &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;public&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;abstract&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MyBasePage&lt;/span&gt; : System.Web.UI.Page &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; Cached reference to Membership.GetUser(); (Currently authenticated user, or null if not auth'd)&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; From Membership.GetUser():&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; Gets the information from the data source and updates the last-activity date/time stamp for the current logged-on membership user.&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman?;color:green?="" style="font-size: 10pt;"&gt;A System.Web.Security.MembershipUser object representing the current logged-on user.&lt;/span&gt;&lt;span ?times="" courier="" new="" new?;mso-fareast-font-family:="" roman?;color:gray?="" style="font-size: 10pt;"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;internal&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; MembershipUser AuthenticatedUser &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 113.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;get &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 113.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 140.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;if&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (_authedUser == &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 140.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 167.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;_authedUser = Membership.GetUser(); &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 140.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 140.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;return&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; _authedUser; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 113.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;private&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; MembershipUser _authedUser; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
To follow this further, you can create a ControlBase class for your user controls which has a typed reference to the BasePage: &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;namespace&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; MyProject.WEB &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;public&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;abstract&lt;/span&gt; &lt;span style="color: blue;"&gt;class&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;MyControlBase&lt;/span&gt; : System.Web.UI.UserControl &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;protected&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; MyPageBase BasePage &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 113.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;get&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; { &lt;span style="color: blue;"&gt;return&lt;/span&gt; (MyPageBase)Page; } &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
Now, from within your control, you can do this.BasePage.UserName to get the currently logged-in username without having to go to the database more than once per page rendering. &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 14pt; text-decoration: underline;"&gt;HttpContext: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
You can use the HttpContext Items array to store values for the duration of the current page rendering (similar to the PageBase pattern above). Personally, I prefer using the PageBase pattern, but there are some cases where this isn’t possible, such as when your working within a CMS framework like SiteCore and don’t actually have access to the page. (SiteCore only allows you to create user controls and place them via their CMS framework). &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; Cached reference to Membership.GetUser(); (Currently authenticated user, or null if not auth'd)&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; From Membership.GetUser():&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; Gets the information from the data source and updates the last-activity date/time stamp for the current logged-on membership user.&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;&amp;lt;returns&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman?;color:green?="" style="font-size: 10pt;"&gt;A System.Web.Security.MembershipUser object representing the current logged-on user.&lt;/span&gt;&lt;span ?times="" courier="" new="" new?;mso-fareast-font-family:="" roman?;color:gray?="" style="font-size: 10pt;"&gt;&amp;lt;/returns&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;internal&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: #2b91af;"&gt;MembershipUser&lt;/span&gt; AuthenticatedUser &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;get &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;if&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (&lt;span style="color: #2b91af;"&gt;HttpContext&lt;/span&gt;.Current.Items[&lt;span style="color: #a31515;"&gt;"CurrentUser"&lt;/span&gt;] == &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 113.35pt;"&gt;
&lt;span color:#2b91af?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;HttpContext&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;.Current.Items[&lt;span style="color: #a31515;"&gt;"CurrentUser"&lt;/span&gt;] = &lt;span style="color: #2b91af;"&gt;Membership&lt;/span&gt;.GetUser(); &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;return&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (&lt;span style="color: #2b91af;"&gt;MembershipUser&lt;/span&gt;)&lt;span style="color: #2b91af;"&gt;HttpContext&lt;/span&gt;.Current.Items[&lt;span style="color: #a31515;"&gt;"CurrentUser"&lt;/span&gt;]; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 14pt; text-decoration: underline;"&gt;ASP.Net Session: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
Using ASP.Net Session will provide a way to store data across page views for the duration of the user’s visit to the site. Be careful – I’ve seen many people get tangled up with stale session data, particularly on initial page loads. For instance, a user clicks on a button which will initiate an Add/Edit popup in edit mode for a product.&amp;nbsp; The developer stores the product info in Session, then opens the popup control, which checks Session for a product and goes into edit mode if product data exits.&amp;nbsp; The user changes their mind and closes the popup (but the developer forgets to clear the product from session in this case).&amp;nbsp; Then the user clicks the "Add new product" button, showing the same control which should be in "add" mode, but since there is a stale product in session, it enters edit mode for the previous product instead.&amp;nbsp;&amp;nbsp; Make sure that if a user is returning to a page after previously storing page state in session that you correctly handle the potentially stale data. &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;public&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: #2b91af;"&gt;SortDirection&lt;/span&gt; LastSortDirection &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;get &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:green?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;//Note: will return null if no value exists in Session &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;return&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (&lt;span style="color: #2b91af;"&gt;SortDirection&lt;/span&gt;)&lt;span style="color: #2b91af;"&gt;HttpContext&lt;/span&gt;.Current.Session[&lt;span style="color: #a31515;"&gt;"SortDir"&lt;/span&gt;]; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;set &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:#2b91af?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;HttpContext&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;.Current.Session[&lt;span style="color: #a31515;"&gt;"SortDir"&lt;/span&gt;] = &lt;span style="color: blue;"&gt;value&lt;/span&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 14pt; text-decoration: underline;"&gt;ASP.Net Cache: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
The ASP.Net Cache can be used to store objects for a predetermined amount of time across all page requests (ie: at the server level). This is useful for data read from the database that isn’t often changed, such as a list of options for a drop-down list. &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;internal&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;String&lt;/span&gt;&amp;gt; DropDownListOptions &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;get &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;if&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (&lt;span style="color: #2b91af;"&gt;HttpRuntime&lt;/span&gt;.Cache[&lt;span style="color: #a31515;"&gt;"DropDownListOptions"&lt;/span&gt;] == &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 113.35pt;"&gt;
&lt;span color:#2b91af?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;HttpRuntime&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;.Cache.Insert(&lt;span style="color: #a31515;"&gt;"DropDownListOptions"&lt;/span&gt;, DAL.GetListFromDatabase(), &lt;span style="color: blue;"&gt;null&lt;/span&gt;, &lt;span style="color: #2b91af;"&gt;DateTime&lt;/span&gt;.Now.AddHours(24), System.Web.Caching.&lt;span style="color: #2b91af;"&gt;Cache&lt;/span&gt;.NoSlidingExpiration); &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;return&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (&lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;String&lt;/span&gt;&amp;gt;)&lt;span style="color: #2b91af;"&gt;HttpRuntime&lt;/span&gt;.Cache[&lt;span style="color: #a31515;"&gt;"DropDownListOptions"&lt;/span&gt;]; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-family: 'Courier New'; font-size: 10pt; font-weight: bold;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span style="font-weight: bold;"&gt;&lt;span style="font-size: 14pt; text-decoration: underline;"&gt;Cookies: &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
Cookies can be used to save data on the client side and have it returned to you on postback. Note, however, that unlike the other storage mechanisms, cookies have two different storage locations: one for the inbound value and one for the outbound value. So you can’t (at least, not without some additional logic) write a value, then read it again for use later in your page logic (your "read" will just re-get the original value, not the updated value). Generally, I would suggest reading the value at page load, storing it in a property on your page class, then writing it out again in your PreRender code. &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
Also note that not setting a cookie value on your response is not the same as deleting the cookie. The browser will keep the last cookie received until it expires or is explicitly overwritten. &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
Warning: Cookies are stored on the user’s machine, so don’t store sensitive data there and always validate the values you get back (it’s easy to tamper with the values). Encryption is suggested, as is setting the ".Secure” property to restrict transport to HTTPS. &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&amp;nbsp; &lt;br /&gt;
&lt;/div&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;private&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;const&lt;/span&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; COOKIE_NAME = &lt;span style="color: #a31515;"&gt;"MyCookie"&lt;/span&gt;; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;&amp;lt;summary&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman?;color:green?="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; Update the cookie, with expiration time a given amount of time from now.&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;///&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman?;color:green?="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;span color:gray?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;&amp;lt;/summary&amp;gt;&lt;/span&gt;&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;public&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; UpdateCookie(&lt;span style="color: #2b91af;"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af;"&gt;KeyValuePair&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;, &lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt;&amp;gt; cookieItems, &lt;span style="color: #2b91af;"&gt;TimeSpan&lt;/span&gt;? cookieLife) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:#2b91af?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;HttpCookie&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; cookie = Request.Cookies[COOKIE_NAME] ?? &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;HttpCookie&lt;/span&gt;(COOKIE_NAME); &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;foreach&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (&lt;span style="color: #2b91af;"&gt;KeyValuePair&lt;/span&gt;&amp;lt;&lt;span style="color: blue;"&gt;string&lt;/span&gt;, &lt;span style="color: blue;"&gt;string&lt;/span&gt;&amp;gt; cookieItem &lt;span style="color: blue;"&gt;in&lt;/span&gt; cookieItems) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;cookie.Values[cookieItem.Key] = cookieItem.Value; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;if&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (cookieLife.HasValue) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;cookie.Expires = &lt;span style="color: #2b91af;"&gt;DateTime&lt;/span&gt;.Now.Add(cookieLife.Value); &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;Response.Cookies.Set(cookie); &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;public&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;string&lt;/span&gt; ReadCookie(&lt;span style="color: blue;"&gt;string&lt;/span&gt; key) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;string&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; value = &lt;span style="color: blue;"&gt;string&lt;/span&gt;.Empty; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;if&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; (Request.Cookies[COOKIE_NAME] != &lt;span style="color: blue;"&gt;null&lt;/span&gt;) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;value = Request.Cookies[COOKIE_NAME].Values[key]; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 86.35pt;"&gt;
&lt;span color:green?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;//UpdateCookie(cookieName, value); //optional: update the expiration so it rolls outward &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;return&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; value; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;} &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 5.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;&amp;nbsp; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;public&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; &lt;span style="color: blue;"&gt;void&lt;/span&gt; DeleteCookie() &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 32.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span color:blue?="" courier="" new="" new?;mso-fareast-font-family:?times="" roman?;="" style="font-size: 10pt;"&gt;var&lt;/span&gt;&lt;span courier="" mso-fareast-font-family:?times="" new="" new?;="" roman??="" style="font-size: 10pt;"&gt; cookie = &lt;span style="color: blue;"&gt;new&lt;/span&gt; &lt;span style="color: #2b91af;"&gt;HttpCookie&lt;/span&gt;(COOKIE_NAME) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 140.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;{ &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 167.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;Value = &lt;span style="color: blue;"&gt;string&lt;/span&gt;.Empty, &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 167.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;Expires = &lt;span style="color: #2b91af;"&gt;DateTime&lt;/span&gt;.Now.AddDays(-1) &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 140.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman??="" style="font-size: 10pt;"&gt;}; &lt;/span&gt;&lt;br /&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;div class="MsoNormal" style="line-height: normal; margin: 0in 0in 0pt 59.35pt;"&gt;
&lt;span courier="" new="" new?;mso-fareast-font-family:?times="" roman
