<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.stevesmithblog.com/~d/styles/itemcontent.css"?><rss version="2.0"><channel><title>Blog</title><link>http://ardalis.com:80/</link><description>Blog</description><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.stevesmithblog.com/StevenSmith" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="stevensmith" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><feedburner:emailServiceId xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">StevenSmith</feedburner:emailServiceId><feedburner:feedburnerHostname xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0">http://feedburner.google.com</feedburner:feedburnerHostname><item><title>Reviewing Scrumban the Book</title><link>http://ardalis.com:80/reviewing-scrumban-the-book</link><description>&lt;p&gt;&lt;a href="http://amzn.to/wJJMBR"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://ardalis.com/Media/Default/Windows-Live-Writer/Reviewing-Scrumban-the-Book_E09F/image_3.png" width="240" height="240"&gt;&lt;/a&gt;I’ve been reading a bunch of kanban and lean books recently as I work on my Pluralsight course on Introducing Kanban (not published yet – will link to it when it is).&amp;nbsp; The most recent one I’ve finished is &lt;em&gt;&lt;a href="http://amzn.to/wJJMBR"&gt;Scrumban, Essays on Kanban Systems for Lean Software Development&lt;/a&gt;&lt;/em&gt;, by Corey Ladas (I’m doing the reviews in LIFO order).&amp;nbsp; I made a bunch of notes while reading this book, and it has a great deal of useful information.&amp;nbsp; I read &lt;a href="http://amzn.to/zlzuKg"&gt;David Anderson’s Kanban book&lt;/a&gt; first, followed by &lt;a href="http://amzn.to/zmlnVg"&gt;Benson and Barry’s Personal Kanban&lt;/a&gt;.&amp;nbsp; I think reading Scrumban last was definitely the right choice, though if I were recommending these books today I would most likely suggest someone start with Personal Kanban, as it’s the lightest weight of the three.&lt;/p&gt; &lt;p&gt;One thing that sets Scrumban apart from the other books is the narrative style and organization of the book.&amp;nbsp; As it says in the title’s byline, this book is a collection of essays – there isn’t a great deal of cohesion or a consistent narrative guiding you through the book.&amp;nbsp; It also tends to assume a fair bit of of knowledge on the part of the reader, which is one reason why I wouldn’t start off with this book if you’re just starting to learn about kanban and lean software development.&amp;nbsp; I also don’t think the title is particularly fitting, since there is only one essay that deals with scrum and mentions the term scrumban in the whole book.&amp;nbsp; I have a feeling the title was chosen mainly because it was short and would leverage the popularity of scrum to drive up book sales – whether this was the case or was successful I can’t say.&lt;/p&gt; &lt;p&gt;I found a great deal of value in the book, and it is certainly no rehash of the other two kanban titles listed above.&amp;nbsp; There are some very important, basic concepts covered here such as the analogy of kanban tokens to money in one of the first essays.&amp;nbsp; Corey does a great job of examining multiple different approaches to processes and showing their pros and cons.&amp;nbsp; Things like methods for synchronizing different handoffs between related up- and downstream collaborators in a process are explained clearly and are honestly things I’d never given much thought previously.&amp;nbsp; The book also does a great job of reinforcing the notion that time-boxed iterations are a stepping stone to an even more streamlined process.&amp;nbsp; If you’ve ever considered the logical progression of moving from infrequent software builds, to having a daily build, to having continuous integration, you can see the same logic being applied to moving from large project phases and handoffs (e.g. &lt;a href="http://deviq.com/waterfall"&gt;waterfall&lt;/a&gt;) to many smaller and iterative iterations (sprints), to continuous software delivery and one piece flow (ideal).&lt;/p&gt; &lt;p&gt;One criticism I do have of the book is that it often didn’t define new terms and acronyms as they were introduced.&amp;nbsp; I noted a bunch of them:&lt;/p&gt; &lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Analytic_Hierarchy_Process"&gt;AHP prioritization&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Takt_time"&gt;takt time&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;em&gt;&lt;a href="http://en.wikipedia.org/wiki/Heijunka"&gt;heijunka board&lt;/a&gt;&lt;/em&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://www.signalguys.com/c/Andon_Lights.html"&gt;andon lights&lt;/a&gt;&lt;/p&gt; &lt;p&gt;&lt;a href="http://en.wikipedia.org/wiki/Axiomatic_design"&gt;axiomatic design&lt;/a&gt;&lt;/p&gt; &lt;p&gt;There were probably more that I missed because I was already familiar with the term, and of course it’s possible some of these were covered somewhere in the book and I missed them, but these were my “google these later” notes.&amp;nbsp; The links above are the result of my google-fu after-the-fact.&lt;/p&gt; &lt;p&gt;The latter 2/3 of the book shows a bunch of different ways to model processes using task boards, and the effects of each of these designs.&amp;nbsp; The analysis from these areas of the book are easily worth the price of the whole book, considering how much time they’ll save you if you’re just getting started.&amp;nbsp; The book doesn’t propose one right way to go about implementing such systems, but it does a very good job of showing the pros and cons of a number of approaches.&lt;/p&gt; &lt;p&gt;Overall, I thought the book had some great information, but could have been organized better.&amp;nbsp; I would give it 3 or 4 stars on Amazon and would recommend other books first, but if you’ve read the others and still want to learn more, there’s some great information here.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/o9Q3f8aldniFbJ7HX30J5MF02sE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/o9Q3f8aldniFbJ7HX30J5MF02sE/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/o9Q3f8aldniFbJ7HX30J5MF02sE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/o9Q3f8aldniFbJ7HX30J5MF02sE/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.stevesmithblog.com/~ff/StevenSmith?a=3VnQgsWzwhI:XtkPAe1GubM:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=3VnQgsWzwhI:XtkPAe1GubM:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=3VnQgsWzwhI:XtkPAe1GubM:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=3VnQgsWzwhI:XtkPAe1GubM:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=3VnQgsWzwhI:XtkPAe1GubM:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=3VnQgsWzwhI:XtkPAe1GubM:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/3VnQgsWzwhI" height="1" width="1"/&gt;</description><pubDate>Fri, 27 Jan 2012 21:25:38 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/reviewing-scrumban-the-book</guid></item><item><title>Updating Blog to Orchard and Switching Domains</title><link>http://ardalis.com:80/updating-blog-to-orchard-and-switching-domains</link><description>&lt;p&gt;&lt;a href="http://ardalis.com/Media/Default/Windows-Live-Writer/87ac6128314d_D3CC/image_2.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px 0px 5px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://ardalis.com/Media/Default/Windows-Live-Writer/87ac6128314d_D3CC/image_thumb.png" width="376" height="323"&gt;&lt;/a&gt;So, yesterday I posted &lt;a href="http://ardalis.com/Asus-Zen-Ultrabook-First-Impressions"&gt;a review of the new Asus Ultrabook&lt;/a&gt; and, as has become rather predictable lately, the virtual web server hosting my Graffiti-powered blog started having 100% CPU for quite a while after the post went live.&amp;nbsp; Now, I don’t get *that* much traffic, but apparently something with my configuration of Graffiti, the server, and the traffic that I do get is enough for it to bring that server to its knees.&amp;nbsp; And Graffiti, great though it was years ago, just had to go.&lt;/p&gt; &lt;p&gt;I opted to go with &lt;a href="http://www.orchardproject.net/"&gt;Orchard&lt;/a&gt; for several reasons.&amp;nbsp; I’d been on the fence between Orchard and WordPress, but after using WordPress for some other one-off projects over the last 18 months, I’ve grown disenchanted with it.&amp;nbsp; While I did find that it was very cheap to find hosting for WordPress, I also found that these cheaper hosts were (shockingly) not as responsive as I was used to, and also since WordPress is to blogging as Windows has been to PCs, it also is the target of loads of automated hacks, and it didn’t take long before the WordPress accounts I had set up on these shared hosts were compromised.&amp;nbsp; After cleaning them up multiple times only to have the problems recur, I decided I’d just avoid the whole problem by using Orchard (the blogging equivalent of buying a Mac).&amp;nbsp; I’m hosting my new blog with &lt;a href="http://cytanium.com"&gt;Cytanium.com&lt;/a&gt;, which is run by the same awesome folks who run &lt;a href="http://orcsweb.com/"&gt;ORCSWEB&lt;/a&gt; hosting, but is set up better for a personal site like this.&lt;/p&gt; &lt;p&gt;Orchard is incredibly easy to get set up, has loads of extensions, and also happens to use the platform, language, and design approach that I prefer (in this case, .NET, C#, and MVC).&amp;nbsp; There’s &lt;a href="http://www.pluralsight-training.net/microsoft/players/PSODPlayer?author=kevin-kuebler&amp;amp;name=introduction-to-orchard&amp;amp;mode=live&amp;amp;clip=0&amp;amp;course=orchard-fundamentals"&gt;a great introductory course on Pluralsight (intro module is free)&lt;/a&gt; by my fellow NimblePros employee Kevin Kuebler, too, if you’d like some help getting started.&amp;nbsp; Migrating to Orchard was fairly straightforward.&amp;nbsp; I used &lt;a href="http://johnpapa.net/orchardpart1"&gt;John Papa’s blog series on migrating from Graffiti to Orchard&lt;/a&gt; as my primary guide, and it was a huge help.&amp;nbsp; The data migration involved pulling the data out of Graffiti into BlogML, and then sucking in the BlogML back into Orchard.&amp;nbsp; I &lt;a href="https://bitbucket.org/jonsagara/graffititoblogml/pull-request/1/pull-please"&gt;cleaned up the code for doing this a bit&lt;/a&gt;, though the comments are still all wrapped in &amp;lt;p&amp;gt;…&amp;lt;/p&amp;gt;, so use &lt;a href="http://johnpapa.net/orchardpart2"&gt;John’s script&lt;/a&gt; to fix that.&amp;nbsp; The latest version of the &lt;a href="https://bitbucket.org/jonsagara/graffititoblogml/overview"&gt;GraffitiToBlogML code should be here&lt;/a&gt;.&lt;/p&gt; &lt;p&gt;I’m hoping to get Disqus set up for my comments soon (using &lt;a href="http://ithoughthecamewithyou.com/post/Convert-BlogML-comments-to-XWR-for-Disqus.aspx"&gt;this tool to import from BlogML to WXR&lt;/a&gt;), as well as to migrate my old blog data from AspAdvice.com, ArmyAdvice.com, and asp.net/blogs, so that all of my blogging for the last decade can all live here.&amp;nbsp; And hopefully this new account will perform better than the old one – I know I was losing visitors who came to my old site and found it unresponsive and left.&amp;nbsp; If you’re reading this, thanks for sticking with me!&amp;nbsp; :)&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/rtBHv65DYWNBMYyws21wZ1IRRwE/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rtBHv65DYWNBMYyws21wZ1IRRwE/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/rtBHv65DYWNBMYyws21wZ1IRRwE/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/rtBHv65DYWNBMYyws21wZ1IRRwE/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.stevesmithblog.com/~ff/StevenSmith?a=FrBYjD_UF9Q:Fr9TnEVrArs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=FrBYjD_UF9Q:Fr9TnEVrArs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=FrBYjD_UF9Q:Fr9TnEVrArs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=FrBYjD_UF9Q:Fr9TnEVrArs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=FrBYjD_UF9Q:Fr9TnEVrArs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=FrBYjD_UF9Q:Fr9TnEVrArs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/FrBYjD_UF9Q" height="1" width="1"/&gt;</description><pubDate>Thu, 26 Jan 2012 20:43:53 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/updating-blog-to-orchard-and-switching-domains</guid></item><item><title>About Steve</title><link>http://ardalis.com:80/About</link><description>&lt;p&gt;Hi, I'm Steve Smith.&amp;nbsp; I go by Ardalis online because, well, you'd understand if your name was &lt;a href="http://en.wikipedia.org/wiki/Steven_Smith"&gt;Steve Smith&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;This is now the fifth place I've had a blog, if you don't count my initial home page and articles on ASPAlliance.com, which were somewhat blog-like but preceded the term.&amp;nbsp; Unlike my past blog moves (from the ASP.NET/blogs site to AspAdvice.com/blogs and my ArmySteve.com / ArmyAdvice.com/blogs/ArmySteve blogs, and then from there to SteveSmithBlog.com), this time I'm pulling everything into one place.&amp;nbsp; So far I only have the most recent stuff here, but soon you should see content dating back to 10 years ago, all in one easy to find location.&lt;/p&gt;
&lt;p&gt;If you're here, you've found my blog.&amp;nbsp; You may also wish to stalk me via other means:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href="http://twitter.com/ardalis"&gt;Twitter (@ardalis)&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.facebook.com/StevenAndrewSmith"&gt;Facebook&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://www.linkedin.com/in/stevenandrewsmith"&gt;LinkedIn&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://plus.google.com/108098990198986419468/posts"&gt;Google+&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="http://flickr.com/photos/lakequincy/"&gt;Flickr&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Here's some more info on me, which is slightly outdated at the moment (Jan 2012).&lt;/p&gt;
&lt;p&gt;Steve Smith is currently a Senior Architect with &lt;a href="http://codeproject.com/"&gt;The Code Project&lt;/a&gt; and CTO of &lt;a href="http://lakequincy.com/"&gt;Lake Quincy Media&lt;/a&gt;, which he co-founded in 2005.&amp;nbsp; He also founded and continues to run &lt;a href="http://aspalliance.com/"&gt;ASPAlliance.com&lt;/a&gt;, a popular resource for Microsoft programmers.&amp;nbsp; He is a Microsoft &lt;a href="http://theregion.com/profile.aspx?rd=1322"&gt;Regional Director&lt;/a&gt;, an ASP.NET MVP (&lt;a href="https://mvp.support.microsoft.com/profile=179854D4-7379-472E-A6BD-ECD2687C7F47"&gt;profile&lt;/a&gt;), an &lt;a href="http://ineta.org/Speakers/Speakers.aspx"&gt;INETA Speaker&lt;/a&gt;, and an &lt;a href="http://aspinsiders.com/"&gt;ASPInsider&lt;/a&gt;.&amp;nbsp; He's written or contributed to several books on ASP.NET and related topics and is a frequent speaker at industry conferences such as DevConnections and TechEd.&amp;nbsp; Steve also founded and organizes the &lt;a href="http://hudsonsc.com/"&gt;Hudson Software Craftsmanship&lt;/a&gt; group in Hudson, Ohio, where he and his wife Michelle also own &lt;a href="http://distinctivespacesllc.com"&gt;office space&lt;/a&gt; and she manages their agile consulting company, &lt;a href="http://nimblepros.com/"&gt;NimblePros.com&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Steve is a US Army veteran who served in Iraq as a combat engineer platoon leader tasked with finding and destroying unexploded ordnance and clearing IEDs.&amp;nbsp; He received his honorable discharge as an army Captain in 2005 and is now happy to be 100% a civilian.&lt;/p&gt;
&lt;p&gt;Steve lives in Ohio with his wife and business partner Michelle, their daughter Ilyana, and son Nikita.&amp;nbsp; When he's not trying to keep up with his business or technology, Steve enjoys games, bicycling, and karate.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;History&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;In January 2012 I moved my blog from SteveSmithBlog.com to Ardalis.com, which is shorter, more memorable, and lines up with my twitter alias.&lt;/p&gt;
&lt;p&gt;In July 2008 I moved my blog from &lt;a href="http://aspadvice.com/blogs/ssmith"&gt;AspAdvice.com/blogs/ssmith&lt;/a&gt; to my own domain, SteveSmithBlog.com.&amp;nbsp; I'm keeping all the old content at the old blog, as well as my previous &lt;a href="http://armyadvice.com/blogs/armysteve/"&gt;Army blog that I kept while I was in Iraq in 2004&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/URQUfKTmxjNMKDC9Zt2uLaNiVbQ/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/URQUfKTmxjNMKDC9Zt2uLaNiVbQ/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/URQUfKTmxjNMKDC9Zt2uLaNiVbQ/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/URQUfKTmxjNMKDC9Zt2uLaNiVbQ/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.stevesmithblog.com/~ff/StevenSmith?a=unUEibo1wKA:0qdIBWipETI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=unUEibo1wKA:0qdIBWipETI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=unUEibo1wKA:0qdIBWipETI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=unUEibo1wKA:0qdIBWipETI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=unUEibo1wKA:0qdIBWipETI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=unUEibo1wKA:0qdIBWipETI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/unUEibo1wKA" height="1" width="1"/&gt;</description><pubDate>Wed, 25 Jan 2012 23:13:46 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/About</guid></item><item><title>Asus Zen Ultrabook First Impressions</title><link>http://ardalis.com:80/Asus-Zen-Ultrabook-First-Impressions</link><description>&lt;p&gt;Last week a received a new &lt;a href="http://amzn.to/yEuObA"&gt;Asus UX31E Zenbook Ultrabook laptop computer&lt;/a&gt;, which I’ve been putting through the paces.&amp;#160; I’d like to write up my thoughts on the unboxing and my initial impression of the machine, and I’ll write more in a few weeks once I’ve had some more time to use it.&amp;#160; Overall, I really like it so far.&amp;#160; It’s thin, light, shiny, and feels solidly put together.&amp;#160; It’s also extremely fast to start up and has a very reasonable active use battery life and a better sleep/standby battery life than any laptop I’ve ever owned.&lt;/p&gt;  &lt;h2&gt;Unboxing&lt;/h2&gt;  &lt;p&gt;I got my &lt;a href="http://amzn.to/yEuObA"&gt;Asus Zenbook Ultrabook on Amazon&lt;/a&gt;, so of course it came in an Amazon box.&amp;#160; Inside the Amazon box was the Asus box:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000091_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000091" border="0" alt="WP_000091" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000091_thumb.jpg" width="644" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;And inside the Asus shipping box is the actual Zenbook packaging:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000094_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000094" border="0" alt="WP_000094" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000094_thumb.jpg" width="644" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;After removing a bit of shrink wrap, this box opens to reveal the Zenbook and its accessories:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000096_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000096" border="0" alt="WP_000096" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000096_thumb.jpg" width="644" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;After a bit of unpacking and cleaning up some of the Russian nesting doll style boxes, the components look like this:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000097_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000097" border="0" alt="WP_000097" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000097_thumb.jpg" width="644" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The laptop is incredibly thin.&amp;#160; Here it is compared to a thin Bic pen on my desk:&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000102_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000102" border="0" alt="WP_000102" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000102_thumb.jpg" width="644" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It comes with a magnetic clasp carrying sleeve, which I really like.&amp;#160; It’s handy to slide the Zenbook in and out of, and it has a nice texture and feel to it, in addition to feeling pretty durable (though it’s too early to say how well it holds up to real usage).&amp;#160; Because it’s so thin, the Zenbook doesn’t have ports for Ethernet and VGA, opting instead to support only thinner ports like USB and micro-HDMI.&amp;#160; It comes with a small accessory bag and two adapters:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;A USB to Ethernet/RJ-45 adapter &lt;/li&gt;    &lt;li&gt;A micro-HDMI to VGA adapter &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000100_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000100" border="0" alt="WP_000100" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000100_thumb.jpg" width="644" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;I do have two small complaints about the accessories.&amp;#160; Firstly, I wish it came with an HDMI adapter, since our office projector supports HDMI.&amp;#160; That said, I wouldn’t want to give up the VGA adapter, since that’s still the universal standard for projectors everywhere.&amp;#160; Secondly, the accessory bag, while compact and stylishly a match for the larger Zenbook sleeve, does not actually fit into the sleeve.&amp;#160; Likewise, the power adapter certainly doesn’t fit into the sleeve, so you’ll certainly still need some kind of proper laptop bag or backpack to hold these things.&amp;#160; It would have been nice if the sleeve somehow could be just as slick and portable as it is now while still somehow being able to hold the adapters and/or the accessory bag, but I suspect those two desires are simply incompatible with real-world space constraints.&lt;/p&gt;  &lt;p&gt;To support standard HDMI output from the Zenbook, I’ll most likely pick up one of these &lt;a href="http://amzn.to/wA3lhK"&gt;HDMI Female to Micro HDMI Mail Adapters for under $3&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The front and back of the Zenbook are very simple.&amp;#160; The smooth finish is great to look at and has a nice, slick feel to it.&amp;#160; The sleeve, again, is a nice addition to the package, as I’m sure it will protect the Zenbook from fingerprints and accidentally slipping from my fingers in transit.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000101_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000101" border="0" alt="WP_000101" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000101_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000104_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000104" border="0" alt="WP_000104" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000104_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The power adapter is light and the connector the the Zenbook itself is tiny.&amp;#160; I think it’s smaller than a standard 3.5mm headphone jack, though I haven’t measured it or tried to plug my headphones into the power port of the laptop (yet).&amp;#160; I certainly appreciate having a light power supply, since I’ve had laptops in the past with power bricks that weighed (literally) more than the Zenbook itself (I’m looking at you, Alienware).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000105_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000105" border="0" alt="WP_000105" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000105_thumb.jpg" width="644" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Once you open up the machine, it has a nice-sized screen, a huge trackpad, built-in speakers on the inside of the screen’s hinge, a webcam, and the same smooth metal finish found on the outside case.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000106_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000106" border="0" alt="WP_000106" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000106_thumb.jpg" width="644" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Starting For The First Time&lt;/h2&gt;  &lt;p&gt;The Zenbook comes with Windows 7 Home Premium 64-bit.&amp;#160; It also has the Bing Bar installed automatically, but this is the only “crapware” that seems to come preinstalled on the device.&amp;#160; I left the Bing Bar running for almost a day before it annoyed me enough to remove it (I did try to give it a fair chance).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000108_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000108" border="0" alt="WP_000108" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000108_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000109_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000109" border="0" alt="WP_000109" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000109_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Once you’ve started, you’ll see some information about Instant On, which theoretically is a unique Asus technology that saves power and speeds boot time for the computer.&amp;#160; I turned it on and the default desktop widget that displays expected Standby Time doubled as a result.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000111_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000111" border="0" alt="WP_000111" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000111_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000112_2.jpg"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="WP_000112" border="0" alt="WP_000112" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Asus-Zen-Ultrabook-First-Impressions_EBCB/WP_000112_thumb.jpg" width="244" height="184" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Asus also has an automatic update service running, which is set up nearly identically to Windows Update.&amp;#160; You’ll want to make sure you get the latest drivers via Asus Update, as I have heard of others having issues that were resolved by these updates.&amp;#160; One common issue I’ve seen relates to the trackpad.&amp;#160; It’s different from others I’ve used, as it is both more sensitive to touch and by default somewhat slower (in terms of how fast the mouse pointer moves on the screen based on how far you move your finger – adjustable in Windows).&amp;#160; The left and right “buttons” are actually just regions on the touchpad, too, and so occasionally I’ve accidentally dragged things as I was trying to click.&amp;#160; These are I’m sure just things I need to get used to.&amp;#160; I’ve also read others’ complaints about the keyboard.&amp;#160; It, too, is different from most laptop keyboards I’ve used, but I haven’t had any problems with it, and I’m a relatively fast touch typist.&amp;#160; It requires some getting used to, just like riding a new and unfamiliar bicycle, but once you’re acclimated to it, it’s fine in my so far limited experience.&lt;/p&gt;  &lt;p&gt;The one other oddity I noticed so far is that the power button is placed where the Delete button usually goes (and the delete key is just to the left of the power key).&amp;#160; I almost, once, hit the power button while going for the delete key.&amp;#160; I’m pretty sure it just would have gone to sleep (which it does quite quickly) and I’d have simply had to wake it back up (also very quick), but I caught myself and have had no issue with remembering where the del key is since.&lt;/p&gt;  &lt;p&gt;&lt;em&gt;Disclosure of Material Connection: I received one or more of the products or services mentioned above for free in the hope that I would mention it on my blog. Regardless, I only recommend products or services I use personally and believe my readers will enjoy. I am disclosing this in accordance with the &lt;a href="http://www.access.gpo.gov/nara/cfr/waisidx_03/16cfr255_03.html"&gt;Federal Trade Commission’s 16 CFR, Part 255: “Guides Concerning the Use of Endorsements and Testimonials in Advertising.”&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;  &lt;p&gt;Here’s another &lt;a href="http://reviews.cnet.com/laptops/asus-zenbook-ux31e-dh52/4505-3121_7-35033683.html"&gt;review of the Zenbook on CNET&lt;/a&gt; you may find interesting if you read this far.&amp;#160; I agree with their sentiment, “who doesn't want a thin, unibody metal lightweight laptop that starts fast and has a great battery life?”&lt;/p&gt;  &lt;div class="lqm_ad" lqm_format="1x1" lqm_zone="ron" lqm_publisher="lqm.stevesmith.site"&gt;&lt;/div&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/kY9QkY-ge81PC9kde6I9tZfJb7Q/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kY9QkY-ge81PC9kde6I9tZfJb7Q/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/kY9QkY-ge81PC9kde6I9tZfJb7Q/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/kY9QkY-ge81PC9kde6I9tZfJb7Q/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.stevesmithblog.com/~ff/StevenSmith?a=X-YKDQrPXhU:NXOs6hSHZp4:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=X-YKDQrPXhU:NXOs6hSHZp4:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=X-YKDQrPXhU:NXOs6hSHZp4:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=X-YKDQrPXhU:NXOs6hSHZp4:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=X-YKDQrPXhU:NXOs6hSHZp4:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=X-YKDQrPXhU:NXOs6hSHZp4:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/X-YKDQrPXhU" height="1" width="1"/&gt;</description><pubDate>Wed, 25 Jan 2012 09:18:11 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Asus-Zen-Ultrabook-First-Impressions</guid></item><item><title>Run Your Unit Tests in Parallel to Maximize Performance</title><link>http://ardalis.com:80/Run-Your-Unit-Tests-in-Parallel-to-Maximize-Performance</link><description>&lt;p&gt;If you’re at all serious about testing, at some point you’re going to have a rather large suite of tests that need to run, and you’ll find that your builds are taking longer than you would like because of how long the tests run.&amp;#160; For example, consider this suite of 24 tests, each one of which looks like this one:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_3.png" width="246" height="106" /&gt;&lt;/p&gt;  &lt;p&gt;If you run 24 of these, it’s going to take about 24 seconds, by default:&lt;/p&gt;  &lt;p&gt;&lt;img style="display: inline" title="image" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_6.png" width="640" height="123" /&gt;&lt;/p&gt;  &lt;p&gt;Now of course &lt;a href="http://stevesmithblog.com/blog/unit-test-or-integration-test-and-why-you-should-care/"&gt;it’s important to keep your unit tests and integration tests separate and to know which is which&lt;/a&gt;, but even once you’ve done that, anything you can do to speed up your test execution times is going to be a big help to your productivity.&amp;#160; Slow builds due to slow tests kill productivity:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://xkcd.com/303/"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_11.png" width="244" height="213" /&gt;&lt;/a&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_10.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_thumb_3.png" width="244" height="213" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;One simple way you can speed up your tests is to run them in parallel.&amp;#160; Doing so with MSTest is actually extremely easy to do, although it’s not at all obvious how to do it, since the setting you need to adjust is hidden away and has no user interface exposed.&amp;#160; The really cool thing is that, after you make the change, even if you don’t use the Visual Studio built-in test runner, your tests will run in parallel.&lt;/p&gt;  &lt;h2&gt;Enabling Parallel Testing in MSTest&lt;/h2&gt;  &lt;p&gt;Like most of the settings used by MSTest, the setting you need to tweak to enable parallel unit test execution is in the .testsettings file that you’re using.&amp;#160; In a brand new test project, you should have a Local.testsettings file, like this one:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_14.png" width="244" height="197" /&gt;&lt;/p&gt;  &lt;p&gt;If you open this file and click through the various settings boxes, you won’t find anything there related to test parallization.&amp;#160; Go ahead and look.&amp;#160; Ok, satisfied now?&amp;#160; Good, let’s move on.&lt;/p&gt;  &lt;p&gt;Now, if you right-click on the file and open it with an XML Editor, you’ll find some more interesting settings.&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_17.png" width="244" height="150" /&gt;&lt;/p&gt;  &lt;p&gt;Here’s the default XML file:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_19.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_thumb_6.png" width="644" height="144" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;If you go click on the &amp;lt;Execution&amp;gt; element, and attempt to add an attribute to it, you should get some Intellisense/statement completion, showing you what the acceptable attributes are:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_22.png" width="244" height="83" /&gt;&lt;/p&gt;  &lt;p&gt;In this case, the option you want is parallelTestCount.&amp;#160; If you simply set it to 0, the system will automatically choose a number of parallel tests equal to the number of cores detected on your system.&amp;#160; In my case, I have a 4-core machine, so it will use 4 cores.&amp;#160; Save the file. &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Note&lt;/strong&gt;: Typically at this point if you re-run your tests, they will continue to run one-at-a-time.&amp;#160; The .testsettings files are cached and are not read immediately when you make changes to them.&amp;#160; I’ve had success getting them to update by going to the Test View window and hitting the Refresh button there, but if that fails you could simply try closing Visual Studio and re-opening it and your project.&lt;/p&gt;  &lt;p&gt;Run your tests again.&amp;#160; Here’s a screenshot showing them running in the Visual Studio test runner.&amp;#160; You can see there are 4 tests In Progress at the same time:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_25.png" width="244" height="170" /&gt;&lt;/p&gt;  &lt;p&gt;Of course, you can also set the value to a number that exceeds the number of (apparent) cores on your system.&amp;#160; I’ve gotten it to work with as many as 16 on one machine, but on the one I’m working on now, it fails once it exceeds 5 cores.&amp;#160; According to a friend of mine, there is a hotfix available that fixes this bug and allows VS2008/VS2010 to use this setting with a parallelTestCount &amp;gt; 5, and apparently this already works in some environments without this hotfix (such as my laptop).&amp;#160; Likewise, I was able to run tests in parallel using ReSharper’s test runner on my laptop, but on this desktop machine running the latest 6.1 version of R# it is only running one test at a time.&lt;/p&gt;  &lt;p&gt;Nonetheless, if you set the value to 5 and run my suite of 24 1s tests, the entire suite executes in about 5 seconds.&amp;#160; That’s an 80% reduction in total test time, which is pretty amazing, and of course this number gets even bigger if you make it larger (assuming you have the hardware to support it).&lt;/p&gt;  &lt;h2&gt;Caveats&lt;/h2&gt;  &lt;p&gt;You need to be using MSTest.&amp;#160; This doesn’t work with NUnit.&lt;/p&gt;  &lt;p&gt;You may need to be using the Visual Studio built-in test runner.&amp;#160; I had it working with the ReSharper test runner, but it’s not working now on this machine, so YMMV.&lt;/p&gt;  &lt;p&gt;You may not be able to exceed &amp;lt;Execution parallelTestCount=&amp;quot;5&amp;quot;&amp;gt;.&amp;#160; If you need to do so, contact Microsoft support for the hotfix.&amp;#160; If it’s a publicly available link, please link to it in the comments below.&lt;/p&gt;  &lt;p&gt;Your tests should be thread-safe and side effect free.&amp;#160; This rules out most integration tests (&lt;a href="http://stevesmithblog.com/blog/unit-test-or-integration-test-and-why-you-should-care/"&gt;what’s the difference between unit tests and integration tests?&lt;/a&gt;).&amp;#160; You also need to be very careful about any use of global state.&amp;#160; Here’s simple example of a test suite that passes when run sequentially but fails when run in parallel (click to open in new window):&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_27.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/b42b44dd7c37_12B1D/image_thumb_9.png" width="644" height="432" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;h2&gt;Summary&lt;/h2&gt;  &lt;p&gt;Especially as CPUs continue to ship with greater and greater numbers of cores, rather than faster clock speeds, the ability to take advantage of the potential performance of these systems will depend on our ability to perform operations in parallel.&amp;#160; One area in which MSTest currently has the lead on alternatives like NUnit is in parallel test execution, and I hope that the next version of Visual Studio improves upon this feature and makes it more discoverable and addresses some of the current issues it suffers from.&amp;#160; I have confirmed that the XML attribute and test runner behavior in the Visual Studio 11 CTP distributed at the BUILD conference in September 2011 work just as they do today in VS2010.&lt;/p&gt;  &lt;p&gt;You can view and &lt;a href="https://bitbucket.org/ardalis/paralleltests"&gt;download the sample code from its BitBucket Mercurial Repository here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/FHgN63iP6bVAD6-RvrPJ5Mbb2bs/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FHgN63iP6bVAD6-RvrPJ5Mbb2bs/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/FHgN63iP6bVAD6-RvrPJ5Mbb2bs/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/FHgN63iP6bVAD6-RvrPJ5Mbb2bs/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.stevesmithblog.com/~ff/StevenSmith?a=uWZPU7gPhgc:sWSeYsOllKs:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=uWZPU7gPhgc:sWSeYsOllKs:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=uWZPU7gPhgc:sWSeYsOllKs:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=uWZPU7gPhgc:sWSeYsOllKs:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=uWZPU7gPhgc:sWSeYsOllKs:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=uWZPU7gPhgc:sWSeYsOllKs:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/uWZPU7gPhgc" height="1" width="1"/&gt;</description><pubDate>Thu, 19 Jan 2012 02:05:09 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Run-Your-Unit-Tests-in-Parallel-to-Maximize-Performance</guid></item><item><title>Unit Test or Integration Test and Why You Should Care</title><link>http://ardalis.com:80/Unit-Test-or-Integration-Test-and-Why-You-Should-Care</link><description>&lt;p&gt;There remains a fair bit of confusion about what constitutes which kind of test.&amp;#160; Many developers are fairly new to testing, and tend to call any tests of their code “unit tests” even when they’re dealing with something substantially larger than a unit.&amp;#160; The tools don’t really help much here, since the various test runner frameworks all call themselves unit test frameworks, and the various test runners themselves almost universally refer to the tests they run as “unit tests” whether they are or not.&amp;#160; For instance, Visual Studio 2010 starts every new Test Project with a class called UnitTest1 and lets you add a new Unit Test, but nowhere does it mention Integration Tests, Acceptance Tests, Smoke Tests, etc, as you use the same code templates to create each of these.&lt;/p&gt;  &lt;h3&gt;Visual Studio 2010&lt;/h3&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/57c036e98a36_12C55/image_6.png" width="644" height="251" /&gt;&lt;/p&gt;  &lt;p&gt;ReSharper and most other add-in test runners follow the same convention – if you ran run it as a test on your code, it’s probably going to be referred to as a &lt;em&gt;Unit Test&lt;/em&gt;.&lt;/p&gt;  &lt;h3&gt;ReSharper 6.1&lt;/h3&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/57c036e98a36_12C55/image_5.png" width="644" height="342" /&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;So what constitutes a &lt;em&gt;unit test&lt;/em&gt;, and what constitutes an &lt;em&gt;integration test&lt;/em&gt;?&amp;#160; What about other kinds of tests beyond these two?&amp;#160; There’s a decent &lt;a href="http://stackoverflow.com/a/520116"&gt;StackOverflow answer related to this topic&lt;/a&gt;, which lists several kinds of tests and their definitions.&amp;#160; Here is what it has to say about Unit Tests and Integration Tests, specifically:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;     &lt;p&gt;&lt;strong&gt;Unit test&lt;/strong&gt;: Specify and test one point of the contract of single method of a class. This should have a very narrow and well defined scope. Complex dependencies and interactions to the outside world are &lt;a href="http://martinfowler.com/articles/mocksArentStubs.html"&gt;stubbed or mocked&lt;/a&gt;.&lt;/p&gt;   &lt;/li&gt;    &lt;li&gt;     &lt;p&gt;&lt;strong&gt;Integration test&lt;/strong&gt;: Test the correct inter-operation of multiple subsystems. There is whole spectrum there, from testing integration between two classes, to testing integration with the production environment.&lt;/p&gt;   &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;I have my own definition of a unit test, which is that it’s a test that only tests a single path through a single method.&amp;#160; More importantly, it’s a test that has zero dependencies on infrastructure, or on code outside of your control.&amp;#160; Unit tests should run fast – as in very, very fast – because they aren’t touching file systems, databases, networks, email servers, system clocks, etc.&amp;#160; They run your code.&amp;#160; Period.&amp;#160; If you have code that has dependencies, you need to remove them when running your unit tests, typically by using mocks, fakes, or stubs.&amp;#160; I’ve written before about dependencies, if you’re not sure what I mean:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://stevesmithblog.com/blog/avoiding-dependencies/"&gt;Avoiding Dependencies&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://stevesmithblog.com/blog/insidious-dependencies/"&gt;Insidious Dependencies&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://stevesmithblog.com/blog/avoid-entrenched-dependencies/"&gt;Avoid Entrenched Dependencies&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;If you have a test that depends on any of the dependencies listed in the above posts, then you have an integration test.&amp;#160; Integration tests are great and necessary, but they’re generally at least an order of magnitude slower than unit tests, and as such you’re going to be able to run far fewer of them in a given amount of time.&amp;#160; Therefore, you want to write as many &lt;em&gt;unit&lt;/em&gt; tests as you can, and write &lt;em&gt;integration&lt;/em&gt; tests for things unit tests can’t do (like actually testing your infrastructure and interactions between components).&amp;#160; Basically, you want to follow the Test Pyramid, just like in the United States people are encouraged to eat based on the &lt;a href="http://www.nal.usda.gov/fnic/Fpyr/pmap.htm"&gt;Food Pyramid&lt;/a&gt; (with one key difference being that the Test Pyramid is probably better advice and is less controversial).&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/57c036e98a36_12C55/image_9.png" width="646" height="433" /&gt;&lt;/p&gt;      &lt;p&gt;Basically, you want a lot more servings of Unit Tests in your daily diet than Integration Tests, and remember that UI tests, being the most expensive and usually the most brittle, are a &lt;a href="http://www.youtube.com/watch?v=iH9IO6iMO78"&gt;sometimes food&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;How Can You Tell if a Test is a Unit Test or an Integration Test?&lt;/h2&gt;  &lt;p&gt;Here are some quick questions you can use to qualify your tests.&amp;#160; There may be some exceptions to these rules, but these are generally good guidelines.&amp;#160; It’s usually a good idea to separate your unit and integration tests, either as separate projects/assemblies, or at least using separate categories, so that you can run them separately.&amp;#160; You’ll want to run the unit tests all the time, and they should be fast enough that doing so isn’t too painful.&amp;#160; You’ll want to run the integration tests as often as you can bear to do so, but often these take long enough to run that you don’t want to run them with every compile or before every check-in.&lt;/p&gt;  &lt;p&gt;Q: Does the System Under Test (SUT) require an installed and configured and available database in order to run the test successfully?&lt;/p&gt;  &lt;p&gt;A: If yes, then it’s an Integration Test&lt;/p&gt;  &lt;p&gt;Q: Does the SUT talk to the file system?&lt;/p&gt;  &lt;p&gt;A: If yes, then it’s an Integration Test&lt;/p&gt;  &lt;p&gt;Q: Does the SUT reference configuration files directly?&lt;/p&gt;  &lt;p&gt;A: See previous question.&amp;#160; It’s an Integration Test.&lt;/p&gt;  &lt;p&gt;Q: Does the SUT reference a service over the network?&lt;/p&gt;  &lt;p&gt;A: If yes, then it’s an Integration Test&lt;/p&gt;  &lt;p&gt;Q: Does the test take more than 10ms to execute?&lt;/p&gt;  &lt;p&gt;A: If yes, it’s very likely an Integration Test, or at the very least it may be possible to refactor it to run faster.&lt;/p&gt;  &lt;p&gt;Q: Does the SUT send emails as part of the test execution, even via a local SMTP server like &lt;a href="http://smtp4dev.codeplex.com"&gt;smtp4dev&lt;/a&gt;?&lt;/p&gt;  &lt;p&gt;A: If yes, then it’s an Integration Test.&lt;/p&gt;  &lt;p&gt;Q: Does the SUT depend on the system clock?&amp;#160; Are there certain days of the week or times of day when it would behave differently?&lt;/p&gt;  &lt;p&gt;A: If yes, then it’s an Integration Test.&lt;/p&gt;  &lt;p&gt;Q: Does the test make use of a mocking framework?&lt;/p&gt;  &lt;p&gt;A: If yes, then it’s likely a Unit Test.&amp;#160; Generally you shouldn’t need to mock much in your integration tests, or you risk not actually testing your system.&lt;/p&gt;  &lt;h2&gt;References&lt;/h2&gt;  &lt;p&gt;MSDN describes &lt;a href="http://msdn.microsoft.com/en-us/library/aa292197"&gt;Unit Testing&lt;/a&gt; and &lt;a href="http://msdn.microsoft.com/en-us/library/aa292128%28v=vs.71%29.aspx"&gt;Integration Testing&lt;/a&gt; if you’d like an “official” Microsoft source&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stackoverflow.com/questions/520064/what-is-unit-test-integration-test-smoke-test-regression-test"&gt;“What is Unit Test, Integration Test, Smoke test, Regression Test?”&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stackoverflow.com/questions/437897/what-are-unit-testing-and-integration-testing-and-what-other-types-of-testing-s"&gt;“What are unit testing and integration testing, and what other types of testing should I know about?”&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/fgHc0lyEvozrOMIhPLqIu9XG_sI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fgHc0lyEvozrOMIhPLqIu9XG_sI/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/fgHc0lyEvozrOMIhPLqIu9XG_sI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/fgHc0lyEvozrOMIhPLqIu9XG_sI/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.stevesmithblog.com/~ff/StevenSmith?a=L49x29dsQO0:PXJ7beU_Apw:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=L49x29dsQO0:PXJ7beU_Apw:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=L49x29dsQO0:PXJ7beU_Apw:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=L49x29dsQO0:PXJ7beU_Apw:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=L49x29dsQO0:PXJ7beU_Apw:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=L49x29dsQO0:PXJ7beU_Apw:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/L49x29dsQO0" height="1" width="1"/&gt;</description><pubDate>Thu, 19 Jan 2012 00:37:06 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Unit-Test-or-Integration-Test-and-Why-You-Should-Care</guid></item><item><title>CodeMash 2012 Sessions</title><link>http://ardalis.com:80/CodeMash-2012-Sessions</link><description>&lt;p&gt;&lt;a href="http://codemash.org/"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/CodeMash-Sessions_CBB8/image_3.png" width="206" height="209" /&gt;&lt;/a&gt;Last week I presented two half-day workshops at &lt;a href="http://codemash.org/"&gt;CodeMash’s&lt;/a&gt; PreCompiler on Wednesday (with Brendan Enrick), and a session on ASP.NET MVC 4 on Thursday.&amp;#160; CodeMash 2012 was an amazing conference and I’d like to personally thank the organizers as well as the attendees of my own events for making it such a great event.&amp;#160; I’ll post a separate write-up with my experiences shortly – for now I just need to get my slides and demos posted for folks who want them.&lt;/p&gt;  &lt;h2&gt;Beginning Software Craftsmanship&lt;/h2&gt;  &lt;p&gt;The morning PreCompiler was on Beginning Software Craftsmanship, and included some presentations on software craftsmanship, deliberate practice, testing, and pairing.&amp;#160; We had about 25 people in attendance, which was just about perfect for the room we had.&amp;#160; Unfortunately, we had a tiny little 6’ screen to present on, but we made it work and thankfully most of this workshop involves hands-on coding, not watching slides.&amp;#160; The group worked through the &lt;a href="http://nimblepros.com/katas"&gt;Prime Factors kata&lt;/a&gt; several times, and then the &lt;a href="http://nimblepros.com/katas"&gt;String Calculator kata&lt;/a&gt;.&amp;#160; You can &lt;a href="http://ssmith-presentations.s3.amazonaws.com/CodeMash2012BeginningSoftwareCraftsmanship.zip"&gt;download the Beginning Software Craftsmanship slides, katas, and the FizzBuzz demo that Brendan and I worked through here&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;Intermediate Software Craftsmanship&lt;/h2&gt;  &lt;p&gt;In the afternoon PreCompiler, we continued delving into software craftsmanship and practice, with an emphasis on writing quality code.&amp;#160; There was a quick repeat presentation on why software craftsmanship and practice are important, which was good since the afternoon session was standing room only with over 50 people in it at one point, so there were many new faces in addition to folks from the morning session.&amp;#160; Brendan and I presented one lecture on refactoring and SOLID principles to set up the next kata, the &lt;a href="http://nimblepros.com/katas"&gt;Gilded Rose refactoring kata&lt;/a&gt;.&amp;#160; This kata starts with some existing working code, which we provided in several different languages from online sources:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://github.com/professor/GildedRose"&gt;http://github.com/professor/GildedRose&lt;/a&gt; Ruby&lt;/li&gt;    &lt;li&gt;&lt;a href="http://github.com/NotMyself/GildedRose"&gt;http://github.com/NotMyself/GildedRose&lt;/a&gt; C#&lt;/li&gt;    &lt;li&gt;&lt;a href="http://github.com/wouterla/GildedRose"&gt;http://github.com/wouterla/GildedRose&lt;/a&gt; Java&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;The intent of this kata is to practice your refactoring skills, and also to practice working with legacy code that has no test coverage and is in fact very difficult to get under test.&amp;#160; Working in pairs, the teams sought to implement the new feature requested in the kata while following the constraints and attempting to improve the overall design of the code (by, for instance, making it more &lt;a href="http://deviq.com/don-t-repeat-yourself"&gt;DRY&lt;/a&gt; and applying the &lt;a href="http://deviq.com/solid"&gt;SOLID principles&lt;/a&gt;).&lt;/p&gt;  &lt;p&gt;Following the Gilded Rose kata, we worked through the Greed kata, which implements the rules of a simple dice game.&amp;#160; Included in the download below are several implementations of this kata in C#, including one that uses a rules engine that allows new rules to be added while following the &lt;a href="http://deviq.com/open-closed-principle"&gt;Open/Closed Principle&lt;/a&gt; (no changes need to be made to the scoring logic classes).&lt;/p&gt;  &lt;p&gt;&lt;a href="http://ssmith-presentations.s3.amazonaws.com/CodeMash2012IntermediateSoftwareCraftsmanship.zip"&gt;Download the Intermediate Software Craftsmanship slides, katas, and demos here&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;A Lap Around ASP.NET MVC 4&lt;/h2&gt;  &lt;p&gt;On Thursday I gave a morning session on ASP.NET MVC 4.&amp;#160; Unfortunately, I wasn’t able to talk about some of the new features that were under development due to NDA restrictions.&amp;#160; However, that kind of changed about 30 minutes before my talk when Scott Hanselman announced several of the previously private features that were coming to MVC 4, namely integration of Web API directly into MVC and a few new project templates, including a single-page application template.&amp;#160; Look for more info on these topics on &lt;a href="http://hanselman.com/"&gt;Scott’s blog&lt;/a&gt; and/or from &lt;a href="http://weblogs.asp.net/scottgu/"&gt;the Gu himself&lt;/a&gt;, soon.&lt;/p&gt;  &lt;p&gt;My session focused on the new mobile features, recipes, and async features of MVC 4.&amp;#160; You can find my &lt;a href="http://ssmith-presentations.s3.amazonaws.com/CodeMash2012LapAroundASPNETMVC4.zip"&gt;Lap Around ASP.NET MVC 4 slides and demos here&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Hope you enjoyed &lt;a href="http://codemash.org/"&gt;CodeMash&lt;/a&gt; and I look forward to seeing you again soon.&amp;#160; Feel free to follow me on &lt;a href="http://twitter.com/ardalis"&gt;twitter (@ardalis)&lt;/a&gt; to join the conversation!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/LH9Lq0Furf-UTSaeol0GOg-P1So/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LH9Lq0Furf-UTSaeol0GOg-P1So/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/LH9Lq0Furf-UTSaeol0GOg-P1So/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/LH9Lq0Furf-UTSaeol0GOg-P1So/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.stevesmithblog.com/~ff/StevenSmith?a=XlIOOiZncG4:7ZV20gvLbVA:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=XlIOOiZncG4:7ZV20gvLbVA:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=XlIOOiZncG4:7ZV20gvLbVA:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=XlIOOiZncG4:7ZV20gvLbVA:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=XlIOOiZncG4:7ZV20gvLbVA:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=XlIOOiZncG4:7ZV20gvLbVA:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/XlIOOiZncG4" height="1" width="1"/&gt;</description><pubDate>Mon, 16 Jan 2012 15:23:53 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/CodeMash-2012-Sessions</guid></item><item><title>Silverlight 5</title><link>http://ardalis.com:80/Silverlight-5</link><description>&lt;blockquote&gt;   &lt;p&gt;&lt;img style="display: inline; float: right" alt="Microsoft Silverlight" align="right" src="http://www.microsoft.com/silverlight/fw/logoSilverlight.jpg" width="242" height="79" /&gt;“The reports of my death have been greatly exaggerated.” – Mark Twain&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Today, &lt;a href="http://blogs.msdn.com/b/silverlight/archive/2011/12/09/silverlight-5-available-for-download-today.aspx"&gt;Silverlight 5 is released and available for download&lt;/a&gt;!&amp;#160; The Release Candidate has been around for some time, and many of us were expecting the release in November.&amp;#160; Well, here it is, November 39th, and it’s here!&amp;#160; Here are some of the things that are &lt;a href="http://10rem.net/blog/2011/09/04/the-big-list-of-whats-new-or-improved-in-silverlight-5"&gt;New or Improved in Silverlight 5&lt;/a&gt;:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Binding Improvements, including ICustomTypeProvider, Binding in Style Setters, DataContextChanged Event, and Custom Markup Extensions&lt;/li&gt;    &lt;li&gt;Support for the XNA 3D API for 3D graphics&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;3D Render Targets&lt;/li&gt;      &lt;li&gt;3D surface composition settings&lt;/li&gt;      &lt;li&gt;3D multi-sample anti-aliasing&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Other improvements to the Graphics Stack&lt;/li&gt;    &lt;li&gt;Hardware decoding for H.264 media&lt;/li&gt;    &lt;li&gt;Low-latency sound effects (good for games)&lt;/li&gt;    &lt;li&gt;Variable Speed Playback and Trick-play (great if you want to listen to podcasts at high speed)&lt;/li&gt;    &lt;li&gt;Text Improvements&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Text Tracking and Leading&lt;/li&gt;      &lt;li&gt;Linked and Multi-column Text&lt;/li&gt;      &lt;li&gt;OpenType Support&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Better OS integration&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;P/Invoke support&lt;/li&gt;      &lt;li&gt;Multiple Window support&lt;/li&gt;      &lt;li&gt;Full file system access (in full trust)&lt;/li&gt;      &lt;li&gt;Default Filename support in Open/Save FileDialogs&lt;/li&gt;      &lt;li&gt;64-bit browser support in Windows&lt;/li&gt;      &lt;li&gt;Power awareness (don’t sleep while movie is playing, for instance)&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Performance Improvements&lt;/li&gt;    &lt;ul&gt;     &lt;li&gt;Faster Parser&lt;/li&gt;      &lt;li&gt;Multi-Core JIT compilation (improved start-up time)&lt;/li&gt;   &lt;/ul&gt;    &lt;li&gt;Double-Click (and n-click) support&lt;/li&gt;    &lt;li&gt;PivotViewer control&lt;/li&gt;    &lt;li&gt;ComboBox type-ahead search&lt;/li&gt;    &lt;li&gt;Printing improvements&lt;/li&gt;    &lt;li&gt;Tasks from Task Parallel Library&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;&lt;a href="http://10rem.net/blog/2011/09/04/the-big-list-of-whats-new-or-improved-in-silverlight-5"&gt;Pete Brown has a great write-up of these and more features&lt;/a&gt;.&amp;#160; There is another, official list of &lt;a href="http://www.silverlight.net/learn/overview/what%27s-new-in-silverlight-5"&gt;What’s New in Silverlight 5 available on the Silverlight.net site&lt;/a&gt;.&amp;#160; You can learn more at &lt;a href="http://silverlight.net/learn"&gt;http://silverlight.net/learn&lt;/a&gt;, or from Pete’s book, &lt;a href="http://www.amazon.com/gp/product/1617290319/ref=as_li_ss_tl?ie=UTF8&amp;amp;tag=aspalliancecom&amp;amp;linkCode=as2&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=1617290319"&gt;Silverlight 5 in Action&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/sZn7p51_VEr9boyWaxBxe5dsi9k/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sZn7p51_VEr9boyWaxBxe5dsi9k/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/sZn7p51_VEr9boyWaxBxe5dsi9k/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/sZn7p51_VEr9boyWaxBxe5dsi9k/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.stevesmithblog.com/~ff/StevenSmith?a=biOV9BjK1tE:IxA5OR86uj8:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=biOV9BjK1tE:IxA5OR86uj8:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=biOV9BjK1tE:IxA5OR86uj8:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=biOV9BjK1tE:IxA5OR86uj8:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=biOV9BjK1tE:IxA5OR86uj8:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=biOV9BjK1tE:IxA5OR86uj8:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/biOV9BjK1tE" height="1" width="1"/&gt;</description><pubDate>Fri, 09 Dec 2011 15:00:16 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Silverlight-5</guid></item><item><title>Handy EnumerableExtensions</title><link>http://ardalis.com:80/Handy-EnumerableExtensions</link><description>&lt;p&gt;There’s a great site for finding extension methods, &lt;a href="http://extensionmethod.net/"&gt;ExtensionMethod.net&lt;/a&gt;.&amp;#160; I don’t believe either of these came from there, and I’ve not (yet) submitted them there, but here are a couple of extensions on IEnumerable&amp;lt;T&amp;gt; that I’ve found useful recently.&lt;/p&gt;  &lt;h2&gt;ForEach&amp;lt;T&amp;gt;&lt;/h2&gt;  &lt;p&gt;The first one is simply a method that allows you to easily iterate over a sequence and perform an action on it.&amp;#160; This is a pretty commonly useful extension method, so much so that it’s now included in .NET 4.0 out of the box.&amp;#160; But if you’re using an older version of the framework, this is one you can roll yourself.&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ForEach&amp;lt;T&amp;gt;(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; IEnumerable&amp;lt;T&amp;gt; items, Action&amp;lt;T&amp;gt; action)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (T item &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; items)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        action(item);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;h2&gt;ContainsAny&amp;lt;T&amp;gt;&lt;/h2&gt;

&lt;p&gt;If you have a collection, you can test for whether it contains an item by using the .Contains(T item) extension method.&amp;#160; However, this only works for single instances of an item.&amp;#160; What if you have a set of items and you need to know if that set contains any elements of a second set of items?&amp;#160; For that, you want to use ContainsAny(), which you can use with either a params collection (specify each item inline) or with an enumerable parameter.&amp;#160; Here are the methods:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; ContainsAny&amp;lt;T&amp;gt;(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; IEnumerable&amp;lt;T&amp;gt; sequence, &lt;span style="color: #0000ff"&gt;params&lt;/span&gt; T[] matches)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; matches.Any(&lt;span style="color: #0000ff"&gt;value&lt;/span&gt; =&amp;gt; sequence.Contains(&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;bool&lt;/span&gt; ContainsAny&amp;lt;T&amp;gt;(&lt;span style="color: #0000ff"&gt;this&lt;/span&gt; IEnumerable&amp;lt;T&amp;gt; sequence, IEnumerable&amp;lt;T&amp;gt; matches)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; matches.Any(&lt;span style="color: #0000ff"&gt;value&lt;/span&gt; =&amp;gt; sequence.Contains(&lt;span style="color: #0000ff"&gt;value&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;



&lt;p&gt;And here are some passing unit tests that demonstrate how these are used:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;[TestFixture]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; ContainsAnyShould&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ReturnTrueGivenMatchInItemCollection()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        var testList = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;() { &lt;span style="color: #006080"&gt;&amp;quot;A&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;B&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;C&amp;quot;&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        var filterList = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;() { &lt;span style="color: #006080"&gt;&amp;quot;C&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;D&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;E&amp;quot;&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        Assert.IsTrue(testList.ContainsAny(filterList));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ReturnFalseGivenNoMatchInItemCollection()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        var testList = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;() { &lt;span style="color: #006080"&gt;&amp;quot;A&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;B&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;C&amp;quot;&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        var filterList = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;() { &lt;span style="color: #006080"&gt;&amp;quot;D&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;E&amp;quot;&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        Assert.IsFalse(testList.ContainsAny(filterList));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ReturnTrueGivenMatchInParamCollection()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        var testList = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;() { &lt;span style="color: #006080"&gt;&amp;quot;A&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;B&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;C&amp;quot;&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        Assert.IsTrue(testList.ContainsAny(&lt;span style="color: #006080"&gt;&amp;quot;C&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;D&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;E&amp;quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    [Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ReturnFalseGivenNoMatchInParamCollection()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        var testList = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;&amp;gt;() { &lt;span style="color: #006080"&gt;&amp;quot;A&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;B&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;C&amp;quot;&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        Assert.IsFalse(testList.ContainsAny(&lt;span style="color: #006080"&gt;&amp;quot;D&amp;quot;&lt;/span&gt;, &lt;span style="color: #006080"&gt;&amp;quot;E&amp;quot;&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;


Hope these help!
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2Us42qv_c1uo4Q81ZcePbaasY5o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2Us42qv_c1uo4Q81ZcePbaasY5o/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/2Us42qv_c1uo4Q81ZcePbaasY5o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2Us42qv_c1uo4Q81ZcePbaasY5o/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.stevesmithblog.com/~ff/StevenSmith?a=9VIiLMATNJU:IHhJ-MImcHY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=9VIiLMATNJU:IHhJ-MImcHY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=9VIiLMATNJU:IHhJ-MImcHY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=9VIiLMATNJU:IHhJ-MImcHY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=9VIiLMATNJU:IHhJ-MImcHY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=9VIiLMATNJU:IHhJ-MImcHY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/9VIiLMATNJU" height="1" width="1"/&gt;</description><pubDate>Thu, 10 Nov 2011 15:50:32 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Handy-EnumerableExtensions</guid></item><item><title>View HTML Source of Email in GMail and Google Apps</title><link>http://ardalis.com:80/View-HTML-Source-of-Email-in-GMail-and-Google-Apps</link><description>&lt;p&gt;If you’re working on creating a pleasant-looking HTML email template for your site’s newsletter, you’ll want to test it out on the major email clients, including Outlook and GMail.&amp;#160; For instance, if you get &lt;a href="http://www.codeproject.com/Feature/Insider/"&gt;The Code Project’s Insider Daily News&lt;/a&gt; in your GMail inbox, it will look something like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.codeproject.com/script/Mailouts/View.aspx?mlid=9368"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/View-HTML-Source-of-Email-in-GMail-and-G_8804/image_3.png" width="644" height="269" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Now, if you view the source for this page, you’ll get something that’s less than useful.&amp;#160; The whole thing looks like a giant &amp;lt;script&amp;gt; block and has no relation to the HTML that was in your email template.&amp;#160; Of course, the interface uses frames (iframes), and depending on your browser you can also view the frame source:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/View-HTML-Source-of-Email-in-GMail-and-G_8804/image_17.png" width="468" height="484" /&gt;&lt;/p&gt;  &lt;p&gt;Which will yield this:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="SNAGHTML3f56ac0" border="0" alt="SNAGHTML3f56ac0" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/View-HTML-Source-of-Email-in-GMail-and-G_8804/SNAGHTML3f56ac0_1.png" width="644" height="191" /&gt;&lt;/p&gt;  &lt;p&gt;How useful!&lt;/p&gt;  &lt;p&gt;If you *actually* want to see the HTML markup for an email as it was received by the mail server, the way to do that in GMail or Google Apps is to click the triangle icon in the upper right of the message, and select Show Original:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/View-HTML-Source-of-Email-in-GMail-and-G_8804/image_16.png" width="644" height="275" /&gt;&lt;/p&gt;  &lt;p&gt;This will open up a new browser window or tab, with the full email content, including the headers.&amp;#160; Something like this, perhaps:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/View-HTML-Source-of-Email-in-GMail-and-G_8804/image_15.png" width="515" height="484" /&gt;&lt;/p&gt;  &lt;p&gt;All that and *still* no HTML!&amp;#160; But we’re almost there.&amp;#160; If you look at the last line of the headers in the image above, you can see that in this case the message says it has Content-Transfer-Encoding: base64.&amp;#160; That means that long mess of characters in the body of the message is base64-encoded, which further means that we can easily decode it using any base64 decoder.&amp;#160; You can write your own, but there are numerous online tools that will decode base64 for you, including &lt;a href="http://www.opinionatedgeek.com/dotnet/tools/Base64Decode/"&gt;this one I found after a quick search&lt;/a&gt;.&amp;#160; Simply cut and paste everything below (but not including) the Content-Transfer-Encoding: base64 line into the box on the page and click the button and you should see your decoded, beautiful, actual HTML of your email message.&amp;#160; What could be easier than that?&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/View-HTML-Source-of-Email-in-GMail-and-G_8804/image_14.png" width="336" height="484" /&gt;&lt;/p&gt;          &lt;p&gt;Now just copy the output to Notepad or your HTML editor of choice and you should be ready to make whatever tweaks you and your design team would like.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/JP7qL_zA5-xl9nPbjDxDIyMtr8A/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JP7qL_zA5-xl9nPbjDxDIyMtr8A/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/JP7qL_zA5-xl9nPbjDxDIyMtr8A/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/JP7qL_zA5-xl9nPbjDxDIyMtr8A/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.stevesmithblog.com/~ff/StevenSmith?a=YatCD3vMf6Q:864mc3CKGgI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=YatCD3vMf6Q:864mc3CKGgI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=YatCD3vMf6Q:864mc3CKGgI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=YatCD3vMf6Q:864mc3CKGgI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=YatCD3vMf6Q:864mc3CKGgI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=YatCD3vMf6Q:864mc3CKGgI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/YatCD3vMf6Q" height="1" width="1"/&gt;</description><pubDate>Thu, 10 Nov 2011 09:54:06 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/View-HTML-Source-of-Email-in-GMail-and-Google-Apps</guid></item><item><title>Inner Fields and Lazy Initialization in C#</title><link>http://ardalis.com:80/Inner-Fields-and-Lazy-Initialization-in-C%23</link><description>&lt;p&gt;Using lazy initialization in C#, a class’s state is set up such that each property’s get method performs a check to see if the underlying field is null.&amp;#160; If it is, then it calculates or populates the field before returning it.&amp;#160; This is a very simple and common approach, but it requires that the class follows a convention of only accessing the field via the property.&amp;#160; Unfortunately, there are no language features that can enforce this, so it’s possible for errors to creep in.&amp;#160; Here’s an example of this approach working correctly:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Order&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// other properties&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Customer _customer;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Customer Customer&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        get&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (_customer == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                _customer = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Customer();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _customer;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; PrintLabel()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; Customer.CompanyName + &lt;span style="color: #006080"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt; + Customer.Address;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Now here’s where this approach can break down.&amp;#160; Consider the same class as above, but with a rewritten PrintLabel() method:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; PrintLabel()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;  &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _customer.CompanyName + &lt;span style="color: #006080"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt; + _customer.Address;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;This code will still compile just fine, but now will very likely result in a NullReferenceException when it attempts to access properties of the _customer, which may not yet be initialized.&amp;#160; The solution to this would be to control access to the _customer member.&amp;#160; We’ve already set its access to &lt;em&gt;private&lt;/em&gt;, though, which is as restrictive as we can make it.&amp;#160; We could force it to be initialized by moving the work into the class’s constructor, but then we’re losing the benefits of lazy initialization.&amp;#160; I wonder if it wouldn’t be useful to do something like this instead:&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Order&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// other properties&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Customer _customer;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Customer Customer&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        get&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (_customer == &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                _customer = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Customer();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _customer;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; PrintLabel()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; result = _customer.CompanyName; &lt;span style="color: #008000"&gt;// probably results in a NullReferenceException&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; result + &lt;span style="color: #006080"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt; + Customer.Address; &lt;span style="color: #008000"&gt;// ok to access Customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;div&gt;&amp;#160;&lt;/div&gt;

&lt;div&gt;We already have auto-properties in C# that avoid the need for having backing fields in the default case.&amp;#160; I think being able to protect access to backing fields so that they can be configured to only be accessible by their property would be quite useful in a number of cases, including this very common one.&amp;#160; I also don’t believe this would break any existing code or change the language in a way that would make it less easy to understand.&amp;#160; What do you think, is this something the C# team should consider adding in a future version of the language?&lt;/div&gt;

&lt;p&gt;One approach that can be used with the relatively new Lazy&amp;lt;T&amp;gt; type is this one (thanks to Jose Romanie for pointing this out):&lt;/p&gt;

&lt;div id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Order&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Order()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        _customerInitializer = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Lazy&amp;lt;Customer&amp;gt;(() =&amp;gt; &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Customer());&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// other properties&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Lazy&amp;lt;Customer&amp;gt; _customerInitializer;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; Customer Customer&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        get&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; _customerInitializer.Value;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; PrintLabel()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; result = Customer.CompanyName; &lt;span style="color: #008000"&gt;// ok to access Customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; result + &lt;span style="color: #006080"&gt;&amp;quot;\n&amp;quot;&lt;/span&gt; + _customerInitializer.Value.Address; &lt;span style="color: #008000"&gt;// ok to access via .Value&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;I like this approach, and I’m generally a fan of Lazy&amp;lt;T&amp;gt;.&amp;#160; It might eliminate the need for the private backing field idea for properties, as it does provide a means of enforcing the initialization even if the backing field is accessed from within the class.&amp;#160; The only downside is that you need to work with a Lazy&amp;lt;T&amp;gt; instead of a T, but within the class it’s probably not a bad thing for this detail to be exposed.&amp;#160; Thoughts?&amp;#160; &lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/H-FSePdCGQ5YbEql64aba9PLk_o/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H-FSePdCGQ5YbEql64aba9PLk_o/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/H-FSePdCGQ5YbEql64aba9PLk_o/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/H-FSePdCGQ5YbEql64aba9PLk_o/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.stevesmithblog.com/~ff/StevenSmith?a=yiV-9FnamZY:qiP9u0GvSEI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=yiV-9FnamZY:qiP9u0GvSEI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=yiV-9FnamZY:qiP9u0GvSEI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=yiV-9FnamZY:qiP9u0GvSEI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=yiV-9FnamZY:qiP9u0GvSEI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=yiV-9FnamZY:qiP9u0GvSEI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/yiV-9FnamZY" height="1" width="1"/&gt;</description><pubDate>Sat, 29 Oct 2011 12:07:46 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Inner-Fields-and-Lazy-Initialization-in-C%23</guid></item><item><title>RazorEngine Performance and Template Caching</title><link>http://ardalis.com:80/RazorEngine-Performance-and-Template-Caching</link><description>&lt;p&gt;&lt;img style="margin: 0px 0px 5px 5px; display: inline; float: right" align="right" src="http://download.codeplex.com/Download?ProjectName=razorengine&amp;amp;DownloadId=201064&amp;amp;Build=18207" /&gt;I’ve been using &lt;a href="http://razorengine.codeplex.com/"&gt;RazorEngine&lt;/a&gt; on a project and have been impressed with its simplicity and ease-of-use.&amp;#160; However, the performance of the application isn’t quite where I need it to be, and I was pretty sure the issue was with how I was using RazorEngine, especially since I could anecdotally see that the processor consumption on the machine running the app was quite high, and looking at the running tasks it was clear that most of that was a result of csc.exe (C# compiler) activity.&lt;/p&gt;  &lt;p&gt;A bit of searching found &lt;a href="http://razorengine.codeplex.com/discussions/244527"&gt;this discussion thread on codeplex regarding the re-compiling of existing templates&lt;/a&gt;.&amp;#160; The issue is a known one with version 2.1, which is the current release and what I’m using.&amp;#160; However, I talked to Matthew Abbott (aka Antaris) &lt;a href="http://www.fidelitydesign.net/?p=473"&gt;via his blog where he recently discussed what’s coming in RazorEngine v3&lt;/a&gt;, and that led me to go ahead and pull the latest pre-release &lt;a href="https://github.com/Antaris/RazorEngine"&gt;RazorEngine v3 code out of GitHub&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;From there it was pretty trivial to get my code working with the new bits.&amp;#160; Fortunately I’d created an interface ITemplateParser and implemented a RazorEngineTemplateParser, and this latter class was the only one I needed to change to use the new API.&amp;#160; I created a couple of nearly identical unit tests, with the key difference being when they make the call to parse the template.&amp;#160; The caching version provides the same name for the template with each call, while the non-caching one provides a new Guid string as the template name, ensuring a cache miss.&lt;/p&gt;  &lt;p&gt;I don’t have any fancy graphs to show off, since all I did was run a 2-minute load test of each unit test with 5 users and no think time using Visual Studio 2010’s load test runner.&amp;#160; The results were pretty significant, though, and corresponded with the performance I was seeing in my actual application (about 1 request per second on one thread):&lt;/p&gt;  &lt;h2&gt;5 Concurrent Users, Non-Cached&lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#0000ff"&gt;5 Tests/Second&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;  &lt;h2&gt;5 Concurrent Users, Cached&lt;/h2&gt;  &lt;p&gt;&lt;strong&gt;&lt;font color="#0000ff"&gt;1600 Tests/Second&lt;/font&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/dpqla8wuMWs5wqd2MPvW5gktWJU/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dpqla8wuMWs5wqd2MPvW5gktWJU/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/dpqla8wuMWs5wqd2MPvW5gktWJU/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/dpqla8wuMWs5wqd2MPvW5gktWJU/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.stevesmithblog.com/~ff/StevenSmith?a=6QiULnnKc2M:lGjPdsHnDGQ:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=6QiULnnKc2M:lGjPdsHnDGQ:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=6QiULnnKc2M:lGjPdsHnDGQ:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=6QiULnnKc2M:lGjPdsHnDGQ:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=6QiULnnKc2M:lGjPdsHnDGQ:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=6QiULnnKc2M:lGjPdsHnDGQ:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/6QiULnnKc2M" height="1" width="1"/&gt;</description><pubDate>Wed, 26 Oct 2011 17:09:36 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/RazorEngine-Performance-and-Template-Caching</guid></item><item><title>Install Application as Service on Windows Server 2008</title><link>http://ardalis.com:80/Install-Application-as-Service-on-Windows-Server-2008</link><description>&lt;p&gt;You can use the &lt;a href="http://support.microsoft.com/kb/251192"&gt;sc.exe command to install an EXE as a service&lt;/a&gt; on Windows Server 2008.&amp;#160; There’s a good article on &lt;a href="http://tech.einaregilsson.com/2007/08/15/run-windows-service-as-a-console-program/"&gt;creating an application that can easily run as either a console app or as a service here&lt;/a&gt;.&amp;#160; From an administrator command prompt, the syntax is something like this:&lt;/p&gt;  &lt;p&gt;&lt;font face="Consolas"&gt;sc &lt;/font&gt;&lt;font face="Consolas"&gt;\\servername&lt;/font&gt;&lt;font face="Consolas"&gt; create MyService.ServiceName binpath= d:\services\Foo\Foo.exe displayname= MyService.ServiceName&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;Note that for this particular utility, the command line options include the “=” sign in them, so you must have no space before the “=” and you must have a space after the “=”.&amp;#160;&amp;#160; Also the server name must be preceded by \\ to work.&lt;/p&gt;  &lt;p&gt;Assuming it works, you should see something like this:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Install-Application-as-Service-on-Window_8FCA/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Install-Application-as-Service-on-Window_8FCA/image_thumb.png" width="372" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;As you can see from the help message above, the SC.EXE utility can be used for much more than simply creating services, but this is something I’ve had to use it for more than once (and hence I’m blogging it since it’s not necessarily easy to search for).&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/RAymdi73X254P9qMB4CMB8zthP0/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RAymdi73X254P9qMB4CMB8zthP0/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/RAymdi73X254P9qMB4CMB8zthP0/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/RAymdi73X254P9qMB4CMB8zthP0/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.stevesmithblog.com/~ff/StevenSmith?a=7vZaApKpdno:eH7AyO69Yts:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=7vZaApKpdno:eH7AyO69Yts:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=7vZaApKpdno:eH7AyO69Yts:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=7vZaApKpdno:eH7AyO69Yts:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=7vZaApKpdno:eH7AyO69Yts:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=7vZaApKpdno:eH7AyO69Yts:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/7vZaApKpdno" height="1" width="1"/&gt;</description><pubDate>Tue, 25 Oct 2011 10:23:03 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Install-Application-as-Service-on-Windows-Server-2008</guid></item><item><title>Using If This Then That to Automate Your Life</title><link>http://ardalis.com:80/Using-If-This-Then-That-to-Automate-Your-Life</link><description>&lt;p&gt;I’ve just started getting into &lt;a href="http://ifttt.com"&gt;If This Then That (ifttt.com)&lt;/a&gt; and have set up a simple task that will update my &lt;a href="https://www.facebook.com/StevenAndrewSmith"&gt;Steve Smith Facebook Page&lt;/a&gt; whenever I post something here to my blog.&amp;#160; Getting this set up was extremely simple to do, and so far although I’ve only been using it for about an hour I’m quite impressed and enamored with ifttt.com.&amp;#160; Here’s how easy it is to set up something like this:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;1. Register with ifttt.com&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This took 30 seconds.&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/c1556c0045dd_8B28/image_15.png" width="207" height="242" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;2. Create a task&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;If &lt;strong&gt;&lt;em&gt;this&lt;/em&gt;&lt;/strong&gt; (the trigger):&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/c1556c0045dd_8B28/image_3.png" width="441" height="482" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/c1556c0045dd_8B28/image_6.png" width="642" height="366" /&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;&lt;em&gt;Then&lt;/em&gt;&lt;/strong&gt; (the action to take – create a new Link Post on my Facebook Page):&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/c1556c0045dd_8B28/image_9.png" width="642" height="376" /&gt;&lt;/p&gt;  &lt;p&gt;End Result:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/c1556c0045dd_8B28/image_12.png" width="642" height="154" /&gt;&lt;/p&gt;        &lt;p&gt;This is actually the first post I’m making since adding this task, so if this post shows up on &lt;a href="https://www.facebook.com/StevenAndrewSmith"&gt;my Facebook Page&lt;/a&gt; then it worked.&lt;/p&gt;  &lt;h2&gt;Recipes&lt;/h2&gt;  &lt;p&gt;You don’t have to reinvent every wheel with If-This-Then-That.&amp;#160; They support the notion of &lt;em&gt;&lt;a href="http://ifttt.com/recipes"&gt;recipes&lt;/a&gt;&lt;/em&gt;, which are basically combinations of triggers and tasks that others have found useful and shared.&amp;#160; For instance, right now the most popular recipe is one that will automatically save to a folder in DropBox every photo that someone tags you in on Facebook.&amp;#160; Another popular one will automatically email you if the weather forecast calls for rain tomorrow (perhaps to say, “Don’t forget your umbrella!”).&amp;#160; There are over five thousand recipes available so far, so it’s a good place to browse for ideas for how you might use If-This-Then-That to automate some of your life.&lt;/p&gt;  &lt;p&gt;Do you have a favorite recipe or use for If-This-Then-That?&amp;#160; Please let me know in the comments below.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/V_2caF6Pu2NPZV87t1zFWicGq1g/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/V_2caF6Pu2NPZV87t1zFWicGq1g/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/V_2caF6Pu2NPZV87t1zFWicGq1g/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/V_2caF6Pu2NPZV87t1zFWicGq1g/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.stevesmithblog.com/~ff/StevenSmith?a=8npdeVPdzSU:C0MdTMAw7uc:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=8npdeVPdzSU:C0MdTMAw7uc:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=8npdeVPdzSU:C0MdTMAw7uc:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=8npdeVPdzSU:C0MdTMAw7uc:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=8npdeVPdzSU:C0MdTMAw7uc:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=8npdeVPdzSU:C0MdTMAw7uc:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/8npdeVPdzSU" height="1" width="1"/&gt;</description><pubDate>Mon, 24 Oct 2011 23:13:23 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Using-If-This-Then-That-to-Automate-Your-Life</guid></item><item><title>Working with Lazy Loading in Entity Framework Code First</title><link>http://ardalis.com:80/Working-with-Lazy-Loading-in-Entity-Framework-Code-First</link><description>&lt;p&gt;Entity Framework 4 has &lt;a href="http://martinfowler.com/eaaCatalog/lazyLoad.html"&gt;Lazy Loading&lt;/a&gt; built-in and enabled by default.&amp;#160; Here’s a quick bit of code to show you how to work with this feature.&amp;#160; To get started with this, simply create a new Console Application and in nuget (Package Manager Console), run this command:&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;install-package EntityFramework.Sample&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;This will install a simple blog post example.&amp;#160; Copy and paste the following into your Program.cs file (replace everything):&lt;/p&gt;  &lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Linq;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Text;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; EFExample.Models;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; EFExample&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Program&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] args)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            var context = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; BlogContext();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Default Lazy Loading setting is: &amp;quot;&lt;/span&gt; + context.Configuration.LazyLoadingEnabled);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Disabling Lazy Loading...&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            context.Configuration.LazyLoadingEnabled = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// remove a post&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;//context.Posts.Remove(context.Posts.First());&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;//context.SaveChanges();&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;// add a post&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;//var newPost = new Post() { Title = &amp;quot;a test post&amp;quot;, PublishDate = DateTime.Now, Comments = GetComments() };&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;//context.Posts.Add(newPost);&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #008000"&gt;//context.SaveChanges();&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;Dependent Collection is Null with no Lazy Load, no Explicit Include&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var post &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; context.Posts)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                Console.WriteLine(post.Title);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (post.Comments != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var comment &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; post.Comments)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                        Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;  -&amp;quot;&lt;/span&gt; + comment.Text);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;.PadLeft(50, &lt;span style="color: #006080"&gt;'-'&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;With Explicit Include, It is Available (1 db call)&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var post &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; context.Posts.Include(&lt;span style="color: #006080"&gt;&amp;quot;Comments&amp;quot;&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                Console.WriteLine(post.Title);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (post.Comments != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var comment &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; post.Comments)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                        Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;  -&amp;quot;&lt;/span&gt; + comment.Text);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;&amp;quot;&lt;/span&gt;.PadLeft(50, &lt;span style="color: #006080"&gt;'-'&lt;/span&gt;));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            var anotherContext = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; BlogContext();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;With Lazy Loading On, It is Available But Populated Only On First Request&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var post &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; anotherContext.Posts)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                Console.WriteLine(post.Title);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                &lt;span style="color: #0000ff"&gt;if&lt;/span&gt; (post.Comments != &lt;span style="color: #0000ff"&gt;null&lt;/span&gt;)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                    &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (var comment &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; post.Comments)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                        Console.WriteLine(&lt;span style="color: #006080"&gt;&amp;quot;  -&amp;quot;&lt;/span&gt; + comment.Text);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            Console.ReadLine();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; ICollection&amp;lt;Comment&amp;gt; GetComments()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            var comments = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;Comment&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;for&lt;/span&gt; (&lt;span style="color: #0000ff"&gt;int&lt;/span&gt; i = 0; i &amp;lt; 3; i++)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;                comments.Add(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Comment() { Author = &lt;span style="color: #006080"&gt;&amp;quot;author&amp;quot;&lt;/span&gt; + i, Text = &lt;span style="color: #006080"&gt;&amp;quot;comment &amp;quot;&lt;/span&gt; + i });&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; comments;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;I have three test cases shown here.&amp;#160; If you run the program (after adding a post using the commented add a post code) you should see this output:&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Working-with-Lazy-Loading-in-Entity-Fram_13A06/SNAGHTML5bb800cc.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="SNAGHTML5bb800cc" border="0" alt="SNAGHTML5bb800cc" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Working-with-Lazy-Loading-in-Entity-Fram_13A06/SNAGHTML5bb800cc_thumb.png" width="644" height="327" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By default, Entity Framework 4 uses Lazy Loading.&amp;#160; You can disable it with this code:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;context.Configuration.LazyLoadingEnabled = false;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Once this is done, dependent collections like the Comments property of a Post in our example will be null if they are not specifically included.&amp;#160; If you know you need to include a dependent collection or property, you can do so with the .Include() method when you reference the DbSet, like so:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;foreach (var post in context.Posts&lt;font color="#ff0000"&gt;.Include(&amp;quot;Comments&amp;quot;)&lt;/font&gt;)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;With Lazy Loading enabled (again, the default case), there is no need to specify the Include if you’re OK with the fact that in this example 2 calls will be made to the database:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Call One (List Posts – click to enlarge)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Working-with-Lazy-Loading-in-Entity-Fram_13A06/image_2.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Working-with-Lazy-Loading-in-Entity-Fram_13A06/image_thumb.png" width="644" height="187" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Call Two (List Comments for single post)&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Working-with-Lazy-Loading-in-Entity-Fram_13A06/image_4.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Working-with-Lazy-Loading-in-Entity-Fram_13A06/image_thumb_1.png" width="644" height="205" /&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Now, let’s say you want to &lt;a href="http://stackoverflow.com/questions/2967214/disable-lazy-loading-by-default-in-entity-framework-4"&gt;disable lazy loading by default&lt;/a&gt; (i.e. you don’t want to have to remember to set the property every time you instantiate a context).&amp;#160; This is quite simple if you’re using EF Code First and you have a DbContext like the BlogContext in this sample.&amp;#160; Simply add a constructor and in the constructor disable Lazy Loading, like so:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; BlogContext : DbContext {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; DbSet&amp;lt;Post&amp;gt; Posts { get; set; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; DbSet&amp;lt;Comment&amp;gt; Comments { get; set; }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; BlogContext() : &lt;span style="color: #0000ff"&gt;base&lt;/span&gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    {&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.Configuration.LazyLoadingEnabled = &lt;span style="color: #0000ff"&gt;false&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    }&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;That’s it!&amp;#160; Now you know how to work with Lazy Loading in Entity Framework 4.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/UerNlYix9_q5lk0nHxokgsGG6kw/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UerNlYix9_q5lk0nHxokgsGG6kw/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/UerNlYix9_q5lk0nHxokgsGG6kw/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/UerNlYix9_q5lk0nHxokgsGG6kw/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.stevesmithblog.com/~ff/StevenSmith?a=pL-AEh3yZ0s:MG0s0tYhjFI:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=pL-AEh3yZ0s:MG0s0tYhjFI:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=pL-AEh3yZ0s:MG0s0tYhjFI:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=pL-AEh3yZ0s:MG0s0tYhjFI:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=pL-AEh3yZ0s:MG0s0tYhjFI:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=pL-AEh3yZ0s:MG0s0tYhjFI:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/pL-AEh3yZ0s" height="1" width="1"/&gt;</description><pubDate>Sun, 02 Oct 2011 22:57:45 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Working-with-Lazy-Loading-in-Entity-Framework-Code-First</guid></item><item><title>Analyzing Windows 8 and WinRT</title><link>http://ardalis.com:80/Analyzing-Windows-8-and-WinRT</link><description>&lt;p&gt;&lt;a href="http://www.flickr.com/photos/guybarrette/6160248304"&gt;&lt;img style="background-image: none; border-right-width: 0px; margin: 0px 0px 5px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="build_conference" border="0" alt="build_conference" align="right" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/6adb43e5c10e_9E82/build_conference_5.jpg" width="240" height="180" /&gt;&lt;/a&gt;Last week at &lt;a href="http://www.buildwindows.com/"&gt;BUILD&lt;/a&gt;, Microsoft introduced their vision for the next generation of Windows devices with announcements and previews of Windows 8, Metro style applications, and WinRT.&amp;#160; The BUILD conference was the most secretive event I’ve ever known Microsoft to hold, with very few leaks prior to the keynotes that began on Tuesday, September 13th.&amp;#160; Now that the event has come and gone, you can &lt;a href="http://www.buildwindows.com/"&gt;watch the sessions and keynote presentations for yourself here&lt;/a&gt;.&amp;#160; In this post, I am going to offer my own analysis of the event and its announcements, with what I view as some of the strengths and weaknesses of Microsoft’s strategy, and the threats and opportunities it creates.&amp;#160; I’m also going to provide links to a large number of related resources, and I welcome you to post links to your own reaction or others you’ve found insightful in the comments below.&amp;#160; A good place to get started is the &lt;a href="http://blogs.msdn.com/b/b8/"&gt;Building Windows 8 blog&lt;/a&gt;, if you haven’t looked there yet.&lt;/p&gt;  &lt;h2&gt;What Does Windows 8 Offer?&lt;/h2&gt;  &lt;p&gt;Some key messaging from Microsoft regarding Windows 8 are that it is a no-compromise operating system, and that one of the key elements of its design is to be “fast and fluid.”&amp;#160; By no compromise, they mean you are not left with an OS that is only good as a tablet or only good on a desktop.&amp;#160; You can install and use Windows 8 productively on your desktop system, and you can do so with a touch-friendly tablet or similar form factor.&amp;#160; The experience when using the new start menu and Live Tiles is designed to be fast and fluid, and so far based on my usage of the developer preview device I received, it certainly accomplishes this.&amp;#160; The new platform is built around supporting a new style of application development, dubbed Metro style applications.&amp;#160; Jensen Harris, in an excellent session that &lt;strong&gt;should be required viewing for any developer considering building apps for Windows 8&lt;/strong&gt;, describes the design principles behind these applications in his &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011/BPS-1004"&gt;8 Traits of Great Metro Style Apps talk&lt;/a&gt; last Tuesday.&lt;/p&gt;  &lt;p&gt;Windows 8 will also offer new opportunities for developers and consumers in the form of a greatly improved application distribution model.&amp;#160; There will be a new Windows Store built into Windows 8, where consumers will be able to find, download, purchase, and install new apps for their Windows 8 PCs.&amp;#160; The store itself is not yet available, but the early versions of the tools needed to create the distributable packages are available to developers now.&amp;#160; These apps will be verified by Microsoft, but developers will be able to run many verification and validation checks against their app locally, eliminating some frustration when submitting apps.&amp;#160; Apps will also run in a sandboxed environment, with increased security compared with standard Win32 applications today.&lt;/p&gt;  &lt;p&gt;For some time, Windows has had a desktop that in my opinion has been largely underutilized.&amp;#160; It’s a place to put some pretty pictures and maybe a few icons, but otherwise it’s fairly static and anything you want to do happens with the desktop in the background.&amp;#160; It also doesn’t provide any up-to-date information, with the exception of add-ins like widgets and system tray notifications.&amp;#160; With Windows 8 and the use of Live Tiles, this changes and the main view into Windows becomes a dynamic, information-rich display.&amp;#160; Every application can provide Live Tile implementations that surface important details relevant to the application.&amp;#160; An email app might show the number of unread messages, while a weather app might show the current weather.&amp;#160; Users of Windows Phone 7 devices are familiar with Live Tiles and can already appreciate how much more quickly they allow information to be gleaned from the device, and their inclusion in Windows 8 is welcome, if not surprising (we saw them previewed months ago).&lt;/p&gt;  &lt;p&gt;The new Metro design paradigm is clearly a big bet for Microsoft and one that is similar in scope to the announcements centered around .NET and the CLR ten years ago.&amp;#160; The newly announced WinRT APIs that is used to build these Metro-style applications in Windows 8 run completely separate from the .NET framework and CLR used by &amp;quot;classic Windows&amp;quot; applications built on the Win32 library today.&amp;#160; At least in for now, the focus of Metro-style applications is clearly on consumer scenarios such as games and fun social applications.&amp;#160; Data-centric business applications and workhorse apps like Photoshop or Visual Studio will continue to live on as Win32 applications using the classic Windows desktop, it seems to me.&lt;/p&gt;  &lt;p&gt;Developers can build Metro style applications built on the WinRT APIs in Windows using one of several options, as shown in this diagram.&amp;#160; Note that this is not the diagram that Microsoft used during their keynotes, but rather a somewhat more accurate one from &lt;a href="http://dougseven.com"&gt;Doug Seven&lt;/a&gt; (former Microsoft employee) who clarified the original diagram last week.&amp;#160; &lt;a href="http://dougseven.com/2011/09/15/a-bad-picture-is-worth-a-thousand-long-discussions/"&gt;Read his post&lt;/a&gt; on why the original diagram was so confusing.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://dougseven.com/2011/09/15/a-bad-picture-is-worth-a-thousand-long-discussions/"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="win8-new-platform" border="0" alt="win8-new-platform" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/6adb43e5c10e_9E82/win8-new-platform_3.png" width="640" height="359" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The green areas of the “boxology” diagram represent the new components of Metro style Apps.&amp;#160; Developers can build these apps using HTML/CSS/JavaScript, just as they build web applications today.&amp;#160; They can build them with C++ using DirectX or XAML.&amp;#160; Or they can build them using managed languages like C# and VB, using the CLR and the .NET Framework (version 4.5).&amp;#160; There was some confusion about how these various pieces all inter-relate, and Doug’s post helps to eliminate some of them but let me address them here briefly as well.&amp;#160; A lot of the issue comes down to conflating different concepts, specifically languages, APIs, platforms, and products.&lt;/p&gt;  &lt;p&gt;XAML, HTML, JavaScript, C# – these are all languages, and are separate from platforms and APIs.&amp;#160; You can write XAML for WPF, XAML for Silverlight, or XAML that runs on Windows in the form of new Metro style Apps.&amp;#160; Likewise HTML can run on a variety of platforms, of which each browser is essentially a platform.&amp;#160; HTML/JavaScript applications can now target the Windows platform directly via WinRT APIs.&amp;#160; It’s been possible to use HTML and JavaScript, together or separately, outside of browsers for a very long time now, and this is just one more example of where this can be done.&amp;#160; You can also think of “Metro style” as a design language, with its own patterns and best practices, as described by Jensen Harris in his talk.&lt;/p&gt;  &lt;h2&gt;Strengths&lt;/h2&gt;  &lt;p&gt;Obviously Microsoft has a huge existing install base with Windows, with nearly 450 million copies of Windows 7 sold and over 500 million people signing into Windows Live Services (per month, I think).&amp;#160; Microsoft has also committed to backward compatibility – every application that runs on Windows 7 will run on Windows 8.&amp;#160; This is a huge strength, and it seems clear that a large number of Windows users will upgrade to Windows 8, at some point.&lt;/p&gt;  &lt;p&gt;The new Metro style design is really beautiful.&amp;#160; I honestly haven’t met a single person who doesn’t like it.&amp;#160; I’ve shown it off in the last week to family, friends, coworkers, and strangers on airplanes and ferry boats.&amp;#160; Everyone finds it easy to use, and is impressed by the responsiveness of the touch UI.&amp;#160; This is a big strength.&amp;#160;&amp;#160; Here’s one comment from Twitter on the new UI:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/Mini_J/status/113664554076090368"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/6adb43e5c10e_9E82/image_3.png" width="643" height="76" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;The forthcoming Windows Store, assuming it measures up to its promises, is also a big strength.&amp;#160; Installing applications on Windows 7 today, compared with installing applications on my Windows Phone 7 (or iPad or iPhone), is much more difficult and time-consuming.&amp;#160; In the first case, nothing from locating to purchasing to installing the application is consistent.&amp;#160; In the second case, every bit of the process is consistent and stable.&amp;#160; With the App store that will be available with Windows 8, I predict a new dawn for cool Windows Apps.&lt;/p&gt;  &lt;p&gt;Finally, Microsoft’s development tools are far and away easier to use than Apple’s, and their developer market share is much larger (even given the huge numbers of iOS developers Apple has gained in the last few years).&amp;#160; Assuming Microsoft continues to provide great tools with which to build Apps for its platform, both the tools themselves and the developers who use them will continue to be a strength for Microsoft.&amp;#160; Here’s another thought from the Twitterverse:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/6adb43e5c10e_9E82/image_5.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/6adb43e5c10e_9E82/image_thumb_1.png" width="649" height="122" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Windows 8 devices are full PCs.&amp;#160; You can take them to class, a meeting, or while you travel just like other tablets, but still have full access to your PC’s capabilities.&amp;#160; And when you’re at your desk, you can easily use the device as your primary computer by docking it with other, less portable hardware like external keyboard, mouse, and/or monitors.&amp;#160; Given the choice between having to buy one computer for real work and a separate tablet for convenience use, versus only needing to buy a single device without compromising in this regard, I suspect a large share of the market will opt for the single device offering (&lt;a href="http://business.financialpost.com/2011/09/14/microsoft-expected-to-have-15-of-tablet-market-by-2014/"&gt;some analysts are predicting 15% tablet market share for Microsoft in 2014&lt;/a&gt; versus 1% in 2010).&lt;/p&gt;  &lt;p&gt;Microsoft is also clearly hoping that by embracing standard languages like HTML, CSS, and JavaScript for building these Apps, it will lower the barrier for many developers to create Apps for Windows 8.&amp;#160; Especially developers who might not consider themselves Microsoft or Windows developers today.&amp;#160; There’s no question there are more Web developers than C++ or C# or VB developers, so there’s great potential here as well.&lt;/p&gt;  &lt;h2&gt;Weaknesses&lt;/h2&gt;  &lt;p&gt;Time to market will be critical, of course.&amp;#160; Microsoft is already late to the game, while the iPad continues to dominate the tablet market.&amp;#160; The first iPad was launched on 3 April 2010.&amp;#160; Microsoft has not yet released any dates for a Win8 launch, but I certainly don’t expect it to reach General Availability before 3 April 2012, so they will over 2 years behind the market leader.&amp;#160; I also have no inside information on when the next iPad will ship, but given Apple’s nearly annual release cycle of the iPad and iPhone, it seems likely that an iPad 3 will be making its debut in 2012 as well.&amp;#160; It’s likely that these 3rd generation devices, in addition to having 1st and 2nd generation customers eager to upgrade, will have already dealt with various rough edges that the first generation of Microsoft devices (from various vendors) will be just running into.&lt;/p&gt;  &lt;p&gt;While its developers and their tools are one of its great assets, Microsoft is also looking for a great deal of new learning from its developer community.&amp;#160; Whether you’re currently a C++, web, or .NET developer, you will have to learn new APIs and perhaps new languages in order to be productive with building Metro style Apps for Windows 8.&amp;#160; Many developers may choose to stick with what they know.&lt;/p&gt;  &lt;p&gt;Even if a large number of developers begin to develop new Metro style Apps, the same diversity of languages that offers Microsoft some strengths is also a disadvantage.&amp;#160; Microsoft developers building applications with the .NET Framework have lived in a multi-lingual world from the start, but over time natural selection and market forces have lifted the C# language into dominance.&amp;#160; With that dominance, .NET developers today find it much easier to locate books and online resources that they can readily use, and employers find it easy to locate developers who use the same tools they do.&amp;#160; The risk with supporting 3 different ways to build Metro style Apps is that the same kind of “Tower of Babel” effect that plagued .NET developers will exist for Metro style App developers.&amp;#160; How often will C#/XAML developers find solutions to their questions that are in HTML/JavaScript, and vice versa?&amp;#160; And if you’re an ASP.NET/C# developer today, where do you invest your time while learning how to build Metro style Apps?&amp;#160; Do you pick up XAML, which is completely foreign to ASP.NET, or do you go the somewhat familiar HTML/JS route, and give up your perhaps-beloved C# language?&amp;#160; This classic &lt;a href="http://en.wikipedia.org/wiki/The_Paradox_of_Choice"&gt;Paradox of Choice&lt;/a&gt; (more on this in &lt;a href="http://stevesmithblog.com/blog/winrt-and-the-paradox-of-choice/"&gt;my post on which stack I would recommend for ASP.NET developers&lt;/a&gt;)may prove to be a hindrance to Metro style App development.&lt;/p&gt;  &lt;p&gt;The story for Windows 8 that we’ve seen so far does not include much for the business/enterprise developer.&amp;#160; Games and social apps seem to be the focus at this stage.&amp;#160; It’s possible that as we get closer to a release, Microsoft will announce features that target businesses more so than consumers, but it’s also likely that such features may be pushed off until a later version of Windows.&amp;#160; If that’s the case, it may be that many businesses don’t find a compelling reason to upgrade to Windows 8, and may wait and see what Windows 9 offers. &lt;/p&gt;  &lt;h2&gt;Opportunities&lt;/h2&gt;  &lt;p&gt;Microsoft has a huge opportunity in the tablet space.&amp;#160; Windows 8 is clearly well-poised to challenge the iPad in the rapidly-growing tablet market.&amp;#160; Just as netbooks were huge a few years ago, tablets are huge today, and Microsoft is no doubt hoping they can capitalize on tablets just as they did on netbooks.&lt;/p&gt;  &lt;p&gt;As more and more devices use the Metro style UI, Microsoft is likely to gain loyal customers who find the Live Tiles and general design appealing.&amp;#160; Currently Windows Phone 7 and XBox Kinect share the same Metro design as Windows 8, and we have seen that even some Windows Server applications will be taking on more of a Metro style.&amp;#160; Just as Apple is able to draw in and keep customers with its many iWhatever devices, Microsoft has an opportunity to do the same thing through appropriate use of its Metro design across form factors.&lt;/p&gt;  &lt;p&gt;There are also great opportunities for Windows developers who build Metro style Apps that are distributed through the Windows Store.&amp;#160; I have no doubt there will be new companies made famous by as-yet-unseen apps that are built for this platform.&amp;#160; Who will write an App that will become as popular on Windows 8 as Angry Birds is on iOS?&amp;#160; Time will tell.&lt;/p&gt;  &lt;h2&gt;Threats&lt;/h2&gt;  &lt;p&gt;The biggest thread to Microsoft’s Windows 8 strategy is clearly Apple.&amp;#160; As the dominant player in the touch tablet market, Apple may challenge Microsoft in a number of ways.&amp;#160; Already Apple has a large number of loyal customers, and this number will continue to grow.&amp;#160; Apple also may have a price advantage, though historically Apple’s devices have sold at a premium relative to their competition and thus far we have no pricing on consumer Windows 8 devices (we do know the MSRP of the developer preview devices, but that would not be an apples-to-apples comparison).&amp;#160; If nothing else, there are millions of used iPads that will likely be entering the secondary market as Windows Tablets are being launched, and these may provide a “good enough” tablet for many customers who might otherwise have opted for the more versatile Windows Tablet devices.&lt;/p&gt;  &lt;p&gt;Other market players, such as Google, may also enter the market in earnest.&amp;#160; We’re still quite a ways out from launch, so there’s time for other disruptors to jump in.&lt;/p&gt;  &lt;p&gt;Longer term, it’s possible that Windows’ use of HTML and JavaScript may backfire, in that many Windows developers may learn these skills to build Windows Apps, but later move to other possibly non-Microsoft platforms that also make use of these languages, and which may offer greater reach.&lt;/p&gt;  &lt;p&gt;Finally, with HTML/JS Apps, it’s possible to easily reference web resources, including things such as advertising scripts.&amp;#160; As Google remains the largest advertising player in this space, it’s possible that many free Windows Apps will leverage Google for their advertising, providing Google with a potentially huge revenue stream and even greater access beyond the browser to Windows users.&amp;#160; Microsoft would be wise to offer an App advertising model that keeps many developers using Microsoft’s advertising tools and keeps that revenue for itself, rather than Google.&lt;/p&gt;  &lt;h2&gt;Questions and Answers&lt;/h2&gt;  &lt;p&gt;Q: Where should I go to learn more?    &lt;br /&gt;A: The two best resources today are the &lt;a href="http://channel9.msdn.com/Events/BUILD/BUILD2011"&gt;BUILD sessions&lt;/a&gt; and the &lt;a href="http://blogs.msdn.com/b/b8/"&gt;Building Windows 8 Blog&lt;/a&gt;.&amp;#160; There are other blogger and industry resources listed below, too.&lt;/p&gt;  &lt;p&gt;Q: Where can I download Visual Studio 11 Developer Preview?    &lt;br /&gt;A: &lt;a title="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=27543" href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=27543"&gt;http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;amp;id=27543&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Q: Can I download a preview of the full VS11 Ultimate?    &lt;br /&gt;A: Yes, if you have an &lt;a href="https://msdn.microsoft.com/en-us/subscriptions/securedownloads/default.aspx"&gt;MSDN subscription&lt;/a&gt;.&amp;#160; &lt;/p&gt;  &lt;p&gt;Q: Can I download the source code to the sample Metro style Apps shown at BUILD and installed on the developer tablet?    &lt;br /&gt;A: Yes, here: &lt;a title="http://code.msdn.microsoft.com/Windows-Developer-Preview-6b53adbb" href="http://code.msdn.microsoft.com/Windows-Developer-Preview-6b53adbb"&gt;http://code.msdn.microsoft.com/Windows-Developer-Preview-6b53adbb&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Q: What about the hands-on labs and virtual machines that were available during BUILD?&amp;#160; Can I get those, too?    &lt;br /&gt;A: Yes, even those.&amp;#160; Here are the &lt;a href="http://blogs.msdn.com/b/briankel/archive/2011/09/16/visual-studio-11-application-lifecycle-management-virtual-machine-and-hands-on-labs-demo-scripts.aspx"&gt;VS11 ALM Virtual Machine and Hands-On-Labs instructions&lt;/a&gt;. (these relate to VS11, but not so much to Windows 8, WinRT, and Metro style Apps)&lt;/p&gt;  &lt;p&gt;Q: What is WinRT?    &lt;br /&gt;A: WinRT is a set of APIs that are used to build Metro style Apps.&amp;#160; WinRT is strictly for building Metro style Apps in Windows 8 – you can’t build traditional Windows applications with WinRT, or server-side applications.&lt;/p&gt;  &lt;p&gt;Q: When I work with WinRT from C#/VB, is there a CLR involved?    &lt;br /&gt;A: Yes, the CLR is loaded just as with a standard .NET application.&lt;/p&gt;  &lt;p&gt;Q: What if I’m using C++ or JavaScript – is the CLR involved then?    &lt;br /&gt;A: No, these languages run in their own runtime environments.&lt;/p&gt;  &lt;p&gt;Q: If I’m building an App using C#, can I only use WinRT libraries, or can I still use the .NET Framework libraries?    &lt;br /&gt;A: You can use the new WinRT libraries, as well as a subset of the .NET Framework APIs.&amp;#160; The exact set of things that exist in one or the other isn’t determine yet.&amp;#160; In cases where you could do the same thing in either WinRT or .NET, the .NET approach is typically removed so there is a consistent interface.&amp;#160; Also .NET APIs that block, as opposed to those that can be accessed asynchronously, will typically be removed and replaced with WinRT APIs.&amp;#160; In terms of how this is exposed, it’s done via a profile in Visual Studio, similar to how Silverlight and Windows Phone as well as Windows Client profiles allow access to only portions of the framework today.&lt;/p&gt;  &lt;p&gt;Q: If I’m building my App with (C++/C#/JavaScript), will my API calls look like standard functions in my language and with my object types, or will they use a different standard?    &lt;br /&gt;A: The WinRT APIs have projections for C++_, JavaScript, and .NET.&amp;#160; Each one is designed to make working with WinRT from that language consistent with the language’s type system, capitalization standards, etc.&amp;#160; &lt;a href="http://tirania.org/blog/archive/2011/Sep-15.html"&gt;Learn more about how this works here&lt;/a&gt;.&lt;/p&gt;  &lt;h2&gt;Resources&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/blog/winrt-and-the-paradox-of-choice/"&gt;WinRT and the Paradox of Choice&lt;/a&gt; (my follow up to this analysis)&lt;/p&gt;  &lt;p&gt;Former Microsoft employee &lt;a href="http://dougseven.com/2011/09/15/a-bad-picture-is-worth-a-thousand-long-discussions/"&gt;Doug Seven clarifies the Windows 8 Marketecture Diagram&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Microsoft Watcher Mary-Jo Foley &lt;a href="http://www.zdnet.com/blog/microsoft/heres-the-one-microsoft-windows-8-slide-that-everyone-wants-to-redo/10736"&gt;further analyzes Microsoft’s Windows 8 architecture slide&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Microsoft RD Andrew Brust describes his reaction to the BUILD announcements in &lt;a href="http://www.brustblog.com/archive/2011/09/16/a-tale-of-two-windows.aspx"&gt;A Tale of Two Windows&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Microsoft RD &lt;a href="http://www.lhotka.net/weblog/WinRTAndNET.aspx"&gt;Rocky Lhotka describes how WinRT relates to .NET&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Microsoft RD &lt;a href="http://scottcate.nextslide.com/scott-cate-describes-metro/"&gt;Scott Cate describes Metro&lt;/a&gt; (4:13 minute video)&lt;/p&gt;  &lt;p&gt;Microsoft RD &lt;a href="http://vinodunny.com/blog/post/Windows-8-Dev-Stacke28093My-take-on-it.aspx"&gt;Vinod Unny’s take on the Windows 8 Dev Stack&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Microsoft RD &lt;a href="http://weblogs.asp.net/dwahlin/archive/2011/09/17/why-i-m-excited-about-windows-8.aspx"&gt;Dan Wahlin explains Why He’s Excited About Windows 8&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Mono Founder &lt;a href="http://tirania.org/blog/archive/2011/Sep-15.html"&gt;Miguel de Icaza Demystifies WinRT&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Microsoft RD &lt;a href="http://www.stephenforte.net/PermaLink,guid,94d1645b-ceeb-4402-9daf-4f8dce249026.aspx"&gt;Stephen Forte Describes His First Day Using the Windows 8 Developer Tablet as his only computer&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/mcQ4BRCwXXZbCJa8VVnjhmvTy7Y/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mcQ4BRCwXXZbCJa8VVnjhmvTy7Y/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/mcQ4BRCwXXZbCJa8VVnjhmvTy7Y/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/mcQ4BRCwXXZbCJa8VVnjhmvTy7Y/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.stevesmithblog.com/~ff/StevenSmith?a=mMLDTsTyBhc:SIC0W3BCRKo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=mMLDTsTyBhc:SIC0W3BCRKo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=mMLDTsTyBhc:SIC0W3BCRKo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=mMLDTsTyBhc:SIC0W3BCRKo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=mMLDTsTyBhc:SIC0W3BCRKo:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=mMLDTsTyBhc:SIC0W3BCRKo:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/mMLDTsTyBhc" height="1" width="1"/&gt;</description><pubDate>Fri, 30 Sep 2011 15:06:33 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Analyzing-Windows-8-and-WinRT</guid></item><item><title>3 Tips to Improve Your Connection Strings</title><link>http://ardalis.com:80/3-Tips-to-Improve-Your-Connection-Strings</link><description>&lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" align="right" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_3.png" width="471" height="168" /&gt;&lt;/p&gt;  &lt;p&gt;Due to some database moves, I’ve recently been touching a lot of connection strings, which has me thinking about the topic.&amp;#160; In fact, I put together &lt;a href="http://twtpoll.com/be21o8"&gt;a short survey&lt;/a&gt; on twitter, and invited a bunch of developers and DBAs to share their thoughts, both on twitter and in the survey, on some issues relating to connection strings.&amp;#160; Here are three tips you should know about that, if you’re not already using, should improve your use of connection strings.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Use Windows Authentication (if you can)&lt;/h2&gt;  &lt;p&gt;By far the biggest tip I can offer is that you should be using Windows Authentication.&amp;#160; You can find this guidance directly from Microsoft, when they discuss &lt;a href="http://msdn.microsoft.com/en-us/library/ms144284.aspx"&gt;Choosing an Authentication Mode on MSDN/Books Online&lt;/a&gt;.&amp;#160; Here it is, in their exact words:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_5.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_thumb_1.png" width="244" height="72" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Why is this preferred?&amp;#160; Because the user’s credentials are never sent over the wire.&amp;#160; “Windows Authentication is the default authentication mode, and is much more secure than SQL Server Authentication.”&amp;#160; From the poll I conducted, it seems that most folks do realize that Windows Auth is the way to go, with fully 2/3 of respondents going that route, and another 25% trying to mitigate the security issues of Sql Authentication by at least encrypting the connection strings within the config file:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_7.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_thumb_2.png" width="642" height="335" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;What are the downsides?&amp;#160; Well, it only works with Windows machines, and not across domain boundaries, are the two biggest ones.&amp;#160; There are rumors about performance issues with Windows Authentication, but as far as I can tell,&lt;strong&gt; these are without merit&lt;/strong&gt;.&amp;#160; Here’s &lt;a href="http://www.sql-server-performance.com/forum/threads/sql-server-vs-windows-authentication.13099/"&gt;one thread that explains why even in a worst case scenario, there shouldn’t be any noticeable performance difference between Windows Authentication and SQL Authentication&lt;/a&gt;.&amp;#160; The main reasons given by Microsoft why you might choose SQL Auth are:&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;Support older applications and those that require SQL Server authentication&lt;/li&gt;    &lt;li&gt;Support mixed operating systems, where some users are not authenticated by a Windows domain&lt;/li&gt;    &lt;li&gt;Allow users to connect from unknown or untrusted domains.&lt;/li&gt;    &lt;li&gt;Allow SQL Server to support Web-based applications where users create and connect as their own identities.&lt;/li&gt;    &lt;li&gt;Allow software developers to distribute applications using a complex permission hierarchy based on known, preset SQL Server logins.&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Unless one of these applies to you, &lt;strong&gt;use Windows Authentication&lt;/strong&gt;.&amp;#160; Here are a few more responses from Twitter:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/AngryPets/status/119807207649980416"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_16.png" width="244" height="105" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;h2&gt;Use a Fully Qualified Domain Name for your Database Server Name&lt;/h2&gt;  &lt;p&gt;Sometimes, your database will need to move from one physical server to another.&amp;#160; Similarly, sometimes a web site will need to move from one web server (or hosting center) to another.&amp;#160; In both cases, client applications need to be able to connect to the database (or web site) at its new location.&amp;#160; In both cases, the use of a Fully Qualified Domain Name (FQDN) for the server’s name coupled with the ubiquitous Domain Name Service (DNS) to translate this name into an actual address (IP address) makes it unnecessary for the client to make any change as a result of the move.&amp;#160; If, instead of using a FQDN, you connect to your database’s server by referring to its machine name, or worse, its IP address, then any time the database needs to move to another physical machine, you will need to update every connection string on every application on every machine that references this database.&amp;#160; Depending on the scope of your operation, this can quickly turn into a significant amount of work.&amp;#160; From my survey, about 42% of respondents recommended using FQDNs, with another 43% saying they would use the server’s Machine Name.&amp;#160; Just 9% would refer to the server via its IP Address, something I would personally call a worst practice (I speak from experience here).&amp;#160; Here’s the survey results – I was actually surprised nobody chose the dark blue option just to be snarky:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_9.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_thumb_3.png" width="593" height="482" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Here are a few more comments related to this question:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/DataChomp/status/119803603471974400"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_19.png" width="244" height="107" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/richcampbell/status/119416205105823744"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_28.png" width="244" height="102" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/bsimser/status/119224409541193729"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_31.png" width="244" height="101" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/JeetKunDoug/status/119129924568231936"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_34.png" width="244" height="99" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/keithelder/status/119125249013989376"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_40.png" width="244" height="85" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/keithelder/status/119125027856719873"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_45.png" width="244" height="99" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;It’s also worth checking out &lt;a href="http://technet.microsoft.com/en-us/library/cc771255.aspx"&gt;Dynamic Update&lt;/a&gt;, as Mike Letterle recommends here:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/mletterle/status/119127024672571392"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_37.png" width="278" height="224" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;My recommendation is to create a FQDN per database, rather than using something that corresponds to a particular server.&amp;#160; For instance, it’s not uncommon to have a separate database for authentication and another one for an application’s primary data.&amp;#160; Maybe when your app launches both of these are on a machine named SQL1, at IP address 192.168.0.123.&amp;#160; And let’s assume just to make it interesting that your app will run on a web farm with N web servers, so any time you need to make a change, you’re touching at least N config files.&amp;#160; &lt;/p&gt;  &lt;p&gt;When you specify the server in your connection string, if you use 192.168.0.123, congratulations, you’ve just hardcoded your application to something that can change extremely easily, and you have zero abstraction layer so there is a 100% chance you will need to touch this connection string if either database were to move.&amp;#160; If you refer to the server as SQL1, then at least the IP address can chance and your app can still connect.&amp;#160; But what if you upgrade to a bigger server and move the databases over to the creatively named new server, SQL2?&amp;#160; Now you’ll need to update that connection string… bummer.&amp;#160; So now what if you refer to the server as sql1.mydomain.com, which is a FQDN, for both databases?&amp;#160; Now you’re safe from IP address changes as well as machine name changes, as long as you’re ok with the idea that the FQDN sql1.mydomain.com might actually point to an IP address that is bound to a machine named SQL2.&lt;/p&gt;  &lt;p&gt;But what if your application is reaching the limits of what one database server can handle, and you need to split the authentication database to one database server, and the main application database to another (or let’s say it will stay on SQL1).&amp;#160; Now, again, you’re going to have to go and touch config files and edit connection strings even if you’re using a FQDN to refer to the original database server.&lt;/p&gt;  &lt;p&gt;Now, consider if you refer to your server names with FQDNs that map to each database.&amp;#160; For the authentication database, you refer to it as auth.db.mydomain.com and for the cool application you refer to it as coolapp.db.mydomain.com.&amp;#160; Now of course in DNS both of these map to 192.168.0.123 initially.&amp;#160; If you move everything to SQL2 with a new IP, you can simply change both records.&amp;#160; If you split the databases, you just change one record to reflect the IP of the new server.&amp;#160; You have the ultimate in flexibility and everything is neatly abstracted so that a change in the location of a resource in your network can be managed at the level where it makes sense – using network tools (DNS) rather than impacting every application that depends on the resource.&lt;/p&gt;  &lt;p&gt;And if for some reason it’s beyond your reach to have an internal DNS resolve FQDNs for you, it may still be worthwhile for you to follow this practice, but simply store the mapping between FQDNs and IPs in each of your application/web servers’ hosts files (located in c:\windows\system32\drivers\etc\hosts).&amp;#160; The hosts file is checked before external DNS is, so anything you specify in there will be used by that machine when it maps FQDNs to IPs.&lt;/p&gt;  &lt;h2&gt;Include Your Application’s Name in its Connection String&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://datachomp.com/"&gt;Rob Sullivan&lt;/a&gt; was nice enough to point me to this tip, which &lt;a href="http://datachomp.com/archives/application-connection-ocd/"&gt;he’s blogged about in the past&lt;/a&gt;.&amp;#160; If you don’t include an Application Name= or App= parameter in your connection string, typically the only thing you will see in a tool like SQL Profiler is “.NET SqlClient Data Provider” for every data connection coming in via ADO.NET.&amp;#160; Once you add in the App= parameter, you’ll see your actual application name, instead.&amp;#160; For instance, adding “app=my northwind app” results in a SQL Profiler result that looks like this:&lt;/p&gt;  &lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_22.png" width="644" height="274" /&gt;&lt;/p&gt;  &lt;p&gt;If you’re running a server that a lot of different applications are talking to, this can make it much easier to determine where the various queries are coming from.&amp;#160; Also, if you have a cluster or web farm environment, you can include the hostname of the machine as part of the application name (yes you can get this via other columns, too, if you don’t do this), as Rob also suggests:&lt;/p&gt;  &lt;p&gt;&lt;a href="http://twitter.com/#!/DataChomp/status/119805353490788352"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_25.png" width="244" height="104" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;Just like that, no more mystery involved in determining where various connections and queries are originating.&amp;#160; In the past, I had solved this problem by using SQL Authentication and making each application have its own SQL Server login.&amp;#160; However, with this tip coupled with the first one above, that’s no longer something I would recommend or endorse.&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;For the sake of completeness, here’s the answer to the first question from the survey.&amp;#160; I was hoping I could use these responses to slice the data and see how the answers to the other two questions varied by user role (app dev, DBA, sysadmin), but unfortunately that didn’t work out – maybe next time.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_42.png"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/3-Tips-to-Improve-Your-Connection-String_C0D3/image_thumb_15.png" width="605" height="484" /&gt;&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&amp;#160;&lt;/p&gt;  &lt;p&gt;Thanks to everyone who took my little survey and also participated in the discussion on Twitter.&amp;#160; I learned a few new things that I’ve already started to implement, and I hope this summary helps out other application developers and SQL Server DBAs who work with them/us.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/u-s8vW3f6UUDfETRE-a4fmMcb4c/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/u-s8vW3f6UUDfETRE-a4fmMcb4c/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/u-s8vW3f6UUDfETRE-a4fmMcb4c/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/u-s8vW3f6UUDfETRE-a4fmMcb4c/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.stevesmithblog.com/~ff/StevenSmith?a=_zOFODJZvzA:RLfKcQTTtoo:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=_zOFODJZvzA:RLfKcQTTtoo:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=_zOFODJZvzA:RLfKcQTTtoo:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=_zOFODJZvzA:RLfKcQTTtoo:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=_zOFODJZvzA:RLfKcQTTtoo:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=_zOFODJZvzA:RLfKcQTTtoo:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/_zOFODJZvzA" height="1" width="1"/&gt;</description><pubDate>Fri, 30 Sep 2011 14:43:33 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/3-Tips-to-Improve-Your-Connection-Strings</guid></item><item><title>Speaking at DevReach 2011</title><link>http://ardalis.com:80/Speaking-at-DevReach-2011</link><description>&lt;p&gt;&lt;a href="http://devreach.com/"&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; margin: 0px 0px 5px 5px; padding-left: 0px; padding-right: 0px; display: inline; float: right; border-top: 0px; border-right: 0px; padding-top: 0px" title="DevReach 2011 - Speaker Badge" border="0" alt="DevReach 2011 - Speaker Badge" align="right" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Speaking-at-DevReach-2011_B35C/DevReach%202011%20-%20Speaker%20Badge_3.jpg" width="244" height="128" /&gt;&lt;/a&gt;I’m very pleased to be speaking again at &lt;a href="http://devreach.com/"&gt;DevReach&lt;/a&gt; in Sofia, Bulgaria next month.&amp;#160; As usual, the conference has an amazing list of speakers (which I’m still somewhat amazed includes me), with &lt;a href="http://hanselman.com/"&gt;Scott Hanselman&lt;/a&gt; making the trip out this year to give several sessions.&amp;#160; If you have the opportunity to attend, I highly recommend it.&amp;#160; There’s certainly no other conference in Eastern Europe that comes close.&lt;/p&gt;  &lt;p&gt;This year, I’ll be presenting on three &lt;a href="http://devreach.com/Event/Sessions.aspx"&gt;topics&lt;/a&gt;.&amp;#160; The first is something new for me.&amp;#160; I’ll be co-presenting with Richard Campbell of &lt;a href="dotnetrocks.com"&gt;DotNetRocks&lt;/a&gt; on Performance Tuning ASP.NET – Stories from the Trenches.&amp;#160; For this session, Richard and I are each going to share some of our real world performance tuning stories with the audience.&amp;#160; It should be a lot of fun and will also show off some important tips and techniques for diagnosing and fixing performance problems in real world systems.&lt;/p&gt;  &lt;p&gt;The next topic is also performance-related, which is Improving ASP.NET MVC Application Performance.&amp;#160; I presented on this topic earlier this year at MVCConf, and it was very well-received.&amp;#160; There are, needless to say, a few tips and tricks related to performance that are specific to ASP.NET MVC (as opposed to ASP.NET Web Forms), which I’ll be covering.&amp;#160; I may also look at some of the new async features of ASP.NET MVC 4 and how these impact performance, but I’m not sure yet if that will fit into the session.&lt;/p&gt;  &lt;p&gt;The third session will be on Common Design Patterns.&amp;#160; This is a presentation I’ve given several times, and allows developers to learn about the “low hanging fruit” of design patterns – the ones that I’ve found to be helpful in the largest number of common situations for .NET developers.&amp;#160; Whether you can’t name a single design pattern or you know dozens of them by name and use, this should be an interesting session, and one which usually (at least in the United States) involves audience members a fair bit.&lt;/p&gt;  &lt;p&gt;I’m looking forward to the trip, the sessions, and many great conversations with attendees and speakers from around the world.&amp;#160; I hope to see you there!&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/t7zmxKcqAc9ea0LjWzFHOyW57oI/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/t7zmxKcqAc9ea0LjWzFHOyW57oI/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/t7zmxKcqAc9ea0LjWzFHOyW57oI/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/t7zmxKcqAc9ea0LjWzFHOyW57oI/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.stevesmithblog.com/~ff/StevenSmith?a=Tic0fTgI85s:CrwviDZcvew:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=Tic0fTgI85s:CrwviDZcvew:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=Tic0fTgI85s:CrwviDZcvew:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=Tic0fTgI85s:CrwviDZcvew:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=Tic0fTgI85s:CrwviDZcvew:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=Tic0fTgI85s:CrwviDZcvew:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/Tic0fTgI85s" height="1" width="1"/&gt;</description><pubDate>Fri, 30 Sep 2011 13:42:19 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Speaking-at-DevReach-2011</guid></item><item><title>Cleveland 2011 Software Engineering 101</title><link>http://ardalis.com:80/Cleveland-2011-Software-Engineering-101</link><description>&lt;p&gt;Next Friday, 7 October 2011, Microsoft in Cleveland is hosting a free one-day event focused on the basics of Software Engineering.&amp;#160; There are a handful of seats left before the event sells out.&amp;#160; You can &lt;a href="http://www.eventbrite.com/event/1983445539"&gt;learn more and RSVP for Software Engineering 101 here&lt;/a&gt; (until tickets run out).&amp;#160; The event is being held at the &lt;a href="http://maps.google.com/maps?q=6050+Oak+Tree+Boulevard+North,+Independence,+OH&amp;amp;hl=en&amp;amp;ll=41.39698,-81.662428&amp;amp;spn=0.004068,0.008256&amp;amp;sll=37.0625,-95.677068&amp;amp;sspn=68.596606,135.263672&amp;amp;vpsrc=6&amp;amp;hnear=6050+Oak+Tree+Blvd,+Independence,+Ohio+44131&amp;amp;t=h&amp;amp;z=18"&gt;Microsoft office here&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;h4&gt;&lt;b&gt;Microsoft Corporation&lt;/b&gt;      &lt;br /&gt;6050 Oak Tree Blvd       &lt;br /&gt;Independence, OH 44131&lt;/h4&gt; &lt;/blockquote&gt;  &lt;p&gt;Last year, the event sold out (well, “sold” is misleading, since it’s free), and it’s on track to do so this year as well.&amp;#160; Here’s some more information, from the &lt;a href="http://nimblepros.com/news-and-events/software-engineering-101---cleveland-2011.aspx"&gt;event’s home page&lt;/a&gt;:&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;em&gt;This is a one-day, FREE event designed to improve your software development skills.&amp;#160; Rather than focusing on introductions to new technologies or tools, this conference will help you get better at your craft.&amp;#160; The morning sessions will focus on fundamental principles, patterns, and practices of software development, and the afternoon will be spent on practical exercises that put these fundamentals into action.&amp;#160; While the sessions will mostly make use of .NET and Visual Studio, these topics apply to any language or platform.&lt;/em&gt;&lt;/p&gt;    &lt;p&gt;&lt;em&gt;If possible, bring your own laptop for use in the hands on sessions, with your choice of development and testing tools installed.&amp;#160; We will have prepared material for Visual Studio 2008/2010 and C#, but other environments are welcome.&amp;#160; If you cannot bring a laptop, don't worry - we'll be pairing together so as long as half the attendees have laptops, it will be fine.&lt;/em&gt;&lt;/p&gt; &lt;/blockquote&gt;  &lt;p&gt;Some of the topics that will be covered include NuGet, Mercurial, software testing, refactoring, object oriented principles, and advanced testing with mock objects.&amp;#160; I will be presenting on applying SOLID principles to improve the design of existing code.&amp;#160; The event is being sponsored by &lt;a href="http://nimblepros.com/"&gt;NimblePros&lt;/a&gt;, &lt;a href="http://hudsonsc.com/"&gt;HudsonSC&lt;/a&gt;, &lt;a href="http://microsoft.com/"&gt;Microsoft&lt;/a&gt;, and &lt;a href="http://pluralsight.com/"&gt;Pluralsight&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/2C2S9BBbzuHdbBMsg8gk1KYo7Fg/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2C2S9BBbzuHdbBMsg8gk1KYo7Fg/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/2C2S9BBbzuHdbBMsg8gk1KYo7Fg/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/2C2S9BBbzuHdbBMsg8gk1KYo7Fg/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.stevesmithblog.com/~ff/StevenSmith?a=ySzFUTY688s:bRlB2pGR_kY:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=ySzFUTY688s:bRlB2pGR_kY:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=ySzFUTY688s:bRlB2pGR_kY:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=ySzFUTY688s:bRlB2pGR_kY:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=ySzFUTY688s:bRlB2pGR_kY:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=ySzFUTY688s:bRlB2pGR_kY:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/ySzFUTY688s" height="1" width="1"/&gt;</description><pubDate>Fri, 30 Sep 2011 12:30:39 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Cleveland-2011-Software-Engineering-101</guid></item><item><title>Wiring up an AutoCompleteBox to a JSON Service in Silverlight</title><link>http://ardalis.com:80/Wiring-up-an-AutoCompleteBox-to-a-JSON-Service-in-Silverlight</link><description>&lt;p&gt;I’m currently building an internal application for &lt;a href="http://codeproject.com/"&gt;The Code Project&lt;/a&gt; that needs to be able to transfer the contents of some potentially very large files over the wire.&amp;#160; After considering various ways to get the data from point A to point B, we decided the easiest thing would be to process the text file on the client, and send batches of rows up to the server for processing.&amp;#160; Initially we looked at building a WPF client for this, but then switched over to Silverlight 4 since the rest of the application is web-based and we didn’t want staff to have to worry about a separate standalone application.&lt;/p&gt;  &lt;p&gt;Basically the files get translated into simple lists on the server, so the UI simply consists of “Enter/choose a list” and a drag-and-drop file uploader.&amp;#160; The list selection UI needs to support both selection from existing lists, or creation of new lists.&amp;#160; To that end, I did some searching for an AutoCompleteTextBox in Silverlight, and found &lt;a href="http://www.jeff.wilcox.name/2008/10/introducing-autocompletebox/"&gt;Jeff Wilcox’s article on Introducing the AutoCompleteBox&lt;/a&gt;.&amp;#160; Of course, it doesn’t show how to wire up the contents to a JSON call, so another search yielded &lt;a href="http://timheuer.com/blog/archive/2008/05/06/use-json-data-in-silverlight.aspx"&gt;Tim Heuer’s article on Making Use of JSON data in Silverlight&lt;/a&gt;.&amp;#160; Putting them together, you get something that works quite well for what I need.&lt;/p&gt;  &lt;p&gt;Here’s my XAML for the AutoCompleteBox:&lt;/p&gt;  &lt;div id="codeSnippetWrapper"&gt;   &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;     &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;sdk:AutoCompleteBox&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Height&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;20&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;HorizontalAlignment&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Left&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #ff0000"&gt;Margin&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;12,0,0,0&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #ff0000"&gt;Name&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;autoCompleteBox1&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;VerticalAlignment&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;Top&amp;quot;&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #ff0000"&gt;Width&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;376&amp;quot;&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Grid&lt;/span&gt;.&lt;span style="color: #ff0000"&gt;Row&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;1&amp;quot;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #ff0000"&gt;ValueMemberBinding&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding Name}&amp;quot;&lt;/span&gt; &lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;   &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;sdk:AutoCompleteBox.ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;            &lt;span style="color: #0000ff"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt; &lt;span style="color: #ff0000"&gt;Text&lt;/span&gt;&lt;span style="color: #0000ff"&gt;=&amp;quot;{Binding Name}&amp;quot;&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;TextBlock&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;        &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;DataTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;   &lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;sdk:AutoCompleteBox.ItemTemplate&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #800000"&gt;sdk:AutoCompleteBox&lt;/span&gt;&lt;span style="color: #0000ff"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Note: I’m not a Silverlight expert, so if I’m doing things against best practices, I apologize.&amp;#160; It does, however, work for me as shown.&amp;#160; I wired up the loading of the AutoCompleteBox in my form’s load, since it’s the only thing this page does so I saw no point in doing it lazily when the AutoCompleteBox is used.&amp;#160; I simply added Loaded=”UserControl_Loaded” to my root UserControl element for this.&lt;/p&gt;

&lt;p&gt;Then in the MainPage.xaml.cs, I implemented this Loaded handler like so:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;private&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; UserControl_Loaded(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, RoutedEventArgs e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    WebClient proxy = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; WebClient();&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;string&lt;/span&gt; url = String.Format(&lt;span style="color: #006080"&gt;&amp;quot;{0}/Test/ListSuppressionLists&amp;quot;&lt;/span&gt;, Constants.SERVICEHOSTNAME);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    proxy.OpenReadCompleted += &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; OpenReadCompletedEventHandler(proxy_OpenReadCompleted);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    proxy.OpenReadAsync(&lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Uri(url));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&amp;#160;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;void&lt;/span&gt; proxy_OpenReadCompleted(&lt;span style="color: #0000ff"&gt;object&lt;/span&gt; sender, OpenReadCompletedEventArgs e)&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    Stream myStream = e.Result;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    var serializer = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; DataContractJsonSerializer(&lt;span style="color: #0000ff"&gt;typeof&lt;/span&gt;(SuppressionList[]));&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    SuppressionList[] lists = (SuppressionList[]) serializer.ReadObject(myStream);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    autoCompleteBox1.ItemsSource = lists;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;All that remains is to implement a controller in the ASP.NET MVC application that this Silverlight control will live in (and make sure it has the clientaccesspolicy.xml and crossdomain.xml files, if needed).&amp;#160; The controller action needs to &lt;a href="http://stevesmithblog.com/blog/set-jsonrequestbehavior-to-allowget/"&gt;AllowGet with its JsonResult&lt;/a&gt;, too.&amp;#160; Here’s basically what it looks like:&lt;/p&gt;

&lt;div style="border-bottom: silver 1px solid; text-align: left; border-left: silver 1px solid; padding-bottom: 4px; line-height: 12pt; background-color: #f4f4f4; margin: 20px 0px 10px; padding-left: 4px; width: 97.5%; padding-right: 4px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; border-top: silver 1px solid; cursor: text; border-right: silver 1px solid; padding-top: 4px" id="codeSnippetWrapper"&gt;
  &lt;div style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;
    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;&lt;span style="color: #0000ff"&gt;public&lt;/span&gt; JsonResult ListSuppressionLists()&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;{&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #008000"&gt;// _repository is provided via the Controller constructor and IOC&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;    &lt;span style="color: #0000ff"&gt;return&lt;/span&gt; Json(_repository.ListReadOnly(), JsonRequestBehavior.AllowGet);&lt;/pre&gt;
&lt;!--CRLF--&gt;

    &lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: white; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &amp;#39;Courier New&amp;#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px"&gt;}&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;/div&gt;
&lt;/div&gt;

&lt;p&gt;Here’s the result in action:&lt;/p&gt;

&lt;p&gt;&lt;img style="background-image: none; border-bottom: 0px; border-left: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top: 0px; border-right: 0px; padding-top: 0px" title="image" border="0" alt="image" src="http://stevesmithblog.com/files/media/image/Windows-Live-Writer/Wiring-up-an-AutoCompleteBox_8D58/image_3.png" width="406" height="86" /&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="http://feedads.g.doubleclick.net/~a/g952pHAka19Kcfdt4cG1kQrFf2M/0/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/g952pHAka19Kcfdt4cG1kQrFf2M/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/g952pHAka19Kcfdt4cG1kQrFf2M/1/da"&gt;&lt;img src="http://feedads.g.doubleclick.net/~a/g952pHAka19Kcfdt4cG1kQrFf2M/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.stevesmithblog.com/~ff/StevenSmith?a=M9D1tkSrRNE:BJDhMYcCwis:F7zBnMyn0Lo"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=M9D1tkSrRNE:BJDhMYcCwis:F7zBnMyn0Lo" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=M9D1tkSrRNE:BJDhMYcCwis:V_sGLiPBpWU"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=M9D1tkSrRNE:BJDhMYcCwis:V_sGLiPBpWU" border="0"&gt;&lt;/img&gt;&lt;/a&gt; &lt;a href="http://feeds.stevesmithblog.com/~ff/StevenSmith?a=M9D1tkSrRNE:BJDhMYcCwis:gIN9vFwOqvQ"&gt;&lt;img src="http://feeds.feedburner.com/~ff/StevenSmith?i=M9D1tkSrRNE:BJDhMYcCwis:gIN9vFwOqvQ" border="0"&gt;&lt;/img&gt;&lt;/a&gt;
&lt;/div&gt;&lt;img src="http://feeds.feedburner.com/~r/StevenSmith/~4/M9D1tkSrRNE" height="1" width="1"/&gt;</description><pubDate>Fri, 23 Sep 2011 10:17:52 GMT</pubDate><guid isPermaLink="true">http://ardalis.com:80/Wiring-up-an-AutoCompleteBox-to-a-JSON-Service-in-Silverlight</guid></item></channel></rss>

