<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://codebetter.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Jeremy D. Miller -- The Shade Tree Developer</title><link>http://codebetter.com/blogs/jeremy.miller/default.aspx</link><description>Under the hood and working with .Net, TDD, Software Design, and Agile Stuff

</description><dc:language>en</dc:language><generator>CommunityServer 2007 (Build: 20416.853)</generator><item><title>Let's see, if I...</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/07/01/let-s-see-if-i.aspx</link><pubDate>Tue, 01 Jul 2008 15:04:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:180158</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>15</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=180158</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/07/01/let-s-see-if-i.aspx#comments</comments><description>&lt;p&gt;...am facing a hard problem, that seems like it must be a common scenario, I should probably...&lt;/p&gt;&lt;p&gt;Write an all new logging tool?&amp;nbsp; Um, no.&lt;/p&gt;&lt;p&gt;Reinvent Sql?&amp;nbsp; Um, no&lt;/p&gt;&lt;p&gt;Use IL generation?&amp;nbsp; Immediately stop whatever it is you&amp;#39;re trying to do&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;The correct course of action Grasshopper is to GOOGLE IT FIRST!!!!&amp;nbsp; If it seems like a function that should be in the .Net framework, it is.&amp;nbsp; If you think that somebody has to have already done this, they have. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Listening to a friend, who shall go nameless to protect the victim&amp;#39;s privacy, gripe about some co-irkers.&amp;nbsp; I like &lt;b&gt;my&lt;/b&gt; job.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=180158" width="1" height="1"&gt;</description></item><item><title>Before you use an IoC tool, some concepts to know first</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/29/some-concepts-to-know-first.aspx</link><pubDate>Sun, 29 Jun 2008 20:40:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:180005</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>26</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=180005</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/29/some-concepts-to-know-first.aspx#comments</comments><description>&lt;h5&gt;&amp;nbsp;&lt;/h5&gt;  &lt;h5&gt;JEREMY’s NOTE:&amp;nbsp; I’m trying to rewrite the StructureMap documentation today, and I’m going to blog most of it out here as I finish it until Brendan tells me to stop polluting the main feed.&amp;nbsp; This article is intended to be an introduction to the concepts behind an IoC tool for folks with little or no previous exposure.&amp;nbsp; Feedback will be very much appreciated. &lt;/h5&gt;  &lt;h5&gt;&amp;nbsp;&lt;/h5&gt;  &lt;h5&gt;&amp;nbsp;&lt;/h5&gt;  &lt;h5&gt;From my original release back in June 2004:&amp;nbsp; StructureMap is a Inversion of Control (IoC) slash &lt;a href="http://www.martinfowler.com/articles/injection.html"&gt;Dependency Injection&lt;/a&gt; framework that can be used to improve the architectural qualities of an object oriented system by reducing the mechanical costs of good design techniques.&amp;nbsp; Using StructureMap does not in any way improve your architecture per se, it simply strives to make the mechanics of a good Object Oriented Design cheaper to implement.&amp;nbsp; Additionally, StructureMap allows you to efficiently &lt;b&gt;exploit&lt;/b&gt; a well designed Object Oriented architecture to provide extensibility mechanisms, flexible deployment options, and self validating configuration and deployment.&lt;/h5&gt;  &lt;p&gt;Over the years a series of concepts and principles have been discovered and developed to describe well-structured Object Oriented systems.&amp;nbsp; To most effectively use StructureMap, or any other IoC tool for that matter, your system needs to be designed with these principles first: &lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;a href="http://en.wikipedia.org/wiki/Separation_of_concerns"&gt;Separation of Concerns&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://msdn.microsoft.com/en-us/magazine/cc546578.aspx"&gt;Open Closed Principle, the Single Responsibility Principle, and the Liskov Substitution Principle&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://codebetter.com/blogs/jeremy.miller/pages/129542.aspx"&gt;Responsibilities, Cohesion, and Coupling&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/01/08/Orthogonal-Code.aspx"&gt;Orthogonal Code&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://codebetter.com/blogs/jeremy.miller/pages/129543.aspx"&gt;Dependency Inversion Principle&lt;/a&gt;&lt;/li&gt;    &lt;li&gt;&lt;a href="http://www.artima.com/lejava/articles/designprinciples4.html"&gt;Favor Composition over Inheritance&lt;/a&gt;&lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;To sum it all up, well designed Object Oriented systems are &lt;b&gt;composed&lt;/b&gt; of many objects that work with each other to accomplish to goals of the system.&amp;nbsp; We want our systems to be decomposed into cohesive classes that perform a well defined responsibility within the system, rather than monolithic “God” classes that do too much.&amp;nbsp; A cohesive class will have to be dependent upon other classes to perform services outside of its own tightly defined responsibility.&amp;nbsp; In IoC speak, we call the collaborating objects &lt;b&gt;dependencies&lt;/b&gt;.&amp;nbsp; &lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;h4&gt;Dependencies&lt;/h4&gt;  &lt;p&gt;For example, in my current system we have a class called &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; that governs the creation and editing of Address entities in our web based UI.&amp;nbsp; The AddressEditController needs to validate user input and persist or load data.&amp;nbsp; Those are two distinct responsibilities, so AddressEditController has dependencies on other objects for these services.&amp;nbsp; &lt;/p&gt;  &lt;div style="border:thin solid black;background:white none repeat scroll 0% 50%;font-size:10pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:black;font-family:courier new;"&gt;   &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span&gt;AddressEditController&lt;/span&gt; : &lt;span&gt;Controller&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:green;"&gt;// AddressEditController uses IValidator to validate user input&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:green;"&gt;// and IRepository to load and save Address information&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;readonly&lt;/span&gt; &lt;span&gt;IValidator&lt;/span&gt; _validator;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span&gt;IRepository&lt;/span&gt; _repository;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;So here’s some facts about &lt;font face="Courier New"&gt;AddressEditController:&lt;/font&gt;&lt;/p&gt;  &lt;ul&gt;   &lt;li&gt;&lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; depends on &lt;font face="Courier New"&gt;IValidator&lt;/font&gt; and &lt;font face="Courier New"&gt;IRepository&lt;/font&gt;&amp;nbsp; &lt;/li&gt;    &lt;li&gt;&lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; cannot function unless it has both an &lt;font face="Courier New"&gt;IValidator&lt;/font&gt; and an &lt;font face="Courier New"&gt;IRepository&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;From the concepts section above, for best results, the &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; should be loosely coupled to its dependencies by knowing as little about the inner workings of the real &lt;font face="Courier New"&gt;IValidator&lt;/font&gt; and &lt;font face="Courier New"&gt;IRepository&lt;/font&gt;&lt;/li&gt;    &lt;li&gt;The real IRepository is a Gateway into NHibernate. The concrete Repository class cannot be used without its own dependency trail of external configuration, a Singleton to keep track of an expensive resource, and some NHibernate bootstrapping code.&amp;nbsp; &lt;/li&gt; &lt;/ul&gt;  &lt;p&gt;Just calling a new() constructor on its dependencies isn’t the best design for our &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt;.&amp;nbsp; Creating a concrete Validator class is very possible, but what if we want to selectively replace the implementation of IValidator later?&amp;nbsp; That’s only somewhat likely, but the dependency on Repository is a much larger concern.&amp;nbsp; I might have semantic decoupling between &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; and Repository, but if &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; calls new Repository() itself, &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; will not be able to function without all that NHibernate bootstrapping.&amp;nbsp; I do not want a piece of my user interface to be tightly coupled to the existence of the persistence layer.&amp;nbsp; &lt;/p&gt;  &lt;p&gt;In other scenarios, creating the dependencies may involve more than just calling new() on the dependencies (don’t believe me?&amp;nbsp; Go try to create an HttpContext object).&lt;/p&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; is responsible for the workflow around editing Address entities in the UI.&amp;nbsp; It shouldn’t be concerned with NHibernate configuration and whatnot.&amp;nbsp; One way to solve this problem is to move the responsibility for building its dependencies to somewhere external to &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt;.&amp;nbsp; &lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;h4&gt;Inversion of Control and Dependency Injection&lt;/h4&gt;  &lt;p&gt;In many cases, I don’t want my classes to have to be aware of how their dependencies are created or located.&amp;nbsp; I don’t want controller classes to even care that they’re using an object that is created via Microsoft’s Provider infrastructure, or a Singleton, or needs configuration data.&amp;nbsp; My class should only know the public interfaces of its dependencies.&amp;nbsp; I can make that true by applying “&lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2005/09/20/132290.aspx"&gt;Inversion of Control&lt;/a&gt;.”&amp;nbsp; Instead of doing:&lt;/p&gt;  &lt;div style="border:thin solid black;background:white none repeat scroll 0% 50%;font-size:10pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:black;font-family:courier new;"&gt;   &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; AddressEditController()&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _validator = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span&gt;Validator&lt;/span&gt;();&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _repository = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span&gt;Repository&lt;/span&gt;();&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;where &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; calls linearly through to the constructors on Validator and Repository, we can invert the control to make the creator of &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; responsible for building the dependencies and “pushing” them into &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt;.&amp;nbsp; &lt;/p&gt;  &lt;div style="border:thin solid black;background:white none repeat scroll 0% 50%;font-size:10pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:black;font-family:courier new;"&gt;   &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span&gt;AddressEditController&lt;/span&gt; : &lt;span&gt;Controller&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;    &lt;p style="margin:0px;"&gt;     &lt;/p&gt;&lt;p style="margin:0px;"&gt;&lt;span style="color:green;"&gt;&lt;/span&gt;&lt;/p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;readonly&lt;/span&gt; &lt;span&gt;IValidator&lt;/span&gt; _validator;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span&gt;IRepository&lt;/span&gt; _repository;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; AddressEditController(&lt;span&gt;IValidator&lt;/span&gt; validator, &lt;span&gt;IRepository&lt;/span&gt; repository)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _validator = validator;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _repository = repository;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;The code sample above uses a form of Inversion of Control called &lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2005/10/06/132825.aspx"&gt;Dependency Injection&lt;/a&gt; to push in the dependencies via a constructor function.&amp;nbsp; Of course, at some point, something needs to know how to create the entire chain of dependencies and do all of that Dependency Injection.&amp;nbsp; StructureMap supports a pattern known as &lt;a href="http://martinfowler.com/articles/injection.html#UsingAServiceLocator"&gt;Service Locator&lt;/a&gt;:&lt;/p&gt;  &lt;div style="border:thin solid black;background:white none repeat scroll 0% 50%;font-size:10pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:black;font-family:courier new;"&gt;   &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:green;"&gt;// Creates an AddressEditController with all of its dependencies&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span&gt;AddressEditController&lt;/span&gt; controller = &lt;span&gt;ObjectFactory&lt;/span&gt;.GetInstance&amp;lt;&lt;span&gt;AddressEditController&lt;/span&gt;&amp;gt;();&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;&lt;font face="Courier New"&gt;ObjectFactory&lt;/font&gt; is a StructureMap class that serves as a well known place to go and find any service that you need.&amp;nbsp; When the &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; is created and returned by &lt;font face="Courier New"&gt;ObjectFactory&lt;/font&gt;, it should be completely ready to go.&amp;nbsp; There’s another important concept to understand before you use StructureMap.&amp;nbsp; &lt;/p&gt;  &lt;p&gt;&amp;nbsp;&lt;/p&gt;  &lt;h4&gt;Auto Wiring&lt;/h4&gt;  &lt;p&gt;Every &amp;quot;real&amp;quot; IoC container supports the concept of &amp;quot;Auto Wiring.&amp;quot;&amp;nbsp; Auto Wiring simply means that StructureMap can figure out dependency chains for you without a lot of explicit configuration.&amp;nbsp; When you ask for &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt;, there is more going on than just &lt;font face="Courier New"&gt;AddressEditController&lt;/font&gt; and its two dependencies.&amp;nbsp; The Repository class itself has its own dependencies.&lt;/p&gt;  &lt;div style="border:thin solid black;background:white none repeat scroll 0% 50%;font-size:10pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:black;font-family:courier new;"&gt;   &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; [&lt;span&gt;DefaultConstructor&lt;/span&gt;]&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; Repository(&lt;span&gt;ISessionSource&lt;/span&gt; source) : &lt;span style="color:blue;"&gt;this&lt;/span&gt;(source.CreateSession())&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;   &lt;b&gt;&lt;/b&gt;&lt;/div&gt;  &lt;p&gt;In turn, the concrete version of &lt;font face="Courier New"&gt;ISessionSource&lt;/font&gt; above has &lt;b&gt;its&lt;/b&gt; own dependencies:&lt;/p&gt;  &lt;div style="border:thin solid black;background:white none repeat scroll 0% 50%;font-size:10pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:black;font-family:courier new;"&gt;   &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; SessionSource(&lt;span&gt;IDictionary&lt;/span&gt;&amp;lt;&lt;span style="color:blue;"&gt;string&lt;/span&gt;, &lt;span style="color:blue;"&gt;string&lt;/span&gt;&amp;gt; properties, &lt;span&gt;PersistenceModel&lt;/span&gt; model)&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _configuration = &lt;span style="color:blue;"&gt;new&lt;/span&gt; &lt;span&gt;Configuration&lt;/span&gt;();&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _configuration.AddProperties(properties);&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; model.Configure(_configuration);&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _sessionFactory = _configuration.BuildSessionFactory();&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;which starts to get interesting because &lt;font face="Courier New"&gt;SessionSource&lt;/font&gt; needs some information like connection strings that have to come in from Xml configuration:&amp;nbsp; &lt;/p&gt;  &lt;div style="border:thin solid black;background:white none repeat scroll 0% 50%;font-size:10pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:black;font-family:courier new;"&gt;   &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;&lt;/span&gt;&lt;span&gt;StructureMap&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;MementoStyle&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;Attribute&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;DefaultInstance&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;PluginType&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;ShadeTree.DomainModel.ISessionSource,ShadeTree.DomainModel&lt;/span&gt;&amp;quot;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;span style="color:red;"&gt;PluggedType&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;ShadeTree.DomainModel.SessionSource,ShadeTree.DomainModel&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;properties&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;Pair&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Key&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;connection.provider&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Value&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;NHibernate.Connection.DriverConnectionProvider&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;Pair&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Key&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;connection.driver_class&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Value&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;NHibernate.Driver.SqlClientDriver&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;Pair&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Key&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;dialect&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Value&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;NHibernate.Dialect.MsSql2000Dialect&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;Pair&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Key&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;hibernate.dialect&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Value&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;NHibernate.Dialect.MsSql2000Dialect&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;Pair&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Key&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;use_outer_join&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Value&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;Pair&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Key&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;connection.connection_string&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Value&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;a connection string that I’m certainly not giving out to you!&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;&lt;/span&gt;&lt;span&gt;Pair&lt;/span&gt;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Key&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;show_sql&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; &lt;/span&gt;&lt;span style="color:red;"&gt;Value&lt;/span&gt;&lt;span style="color:blue;"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color:blue;"&gt; /&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span&gt;properties&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;nbsp; &amp;lt;/&lt;/span&gt;&lt;span&gt;DefaultInstance&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&lt;span style="color:blue;"&gt;&amp;lt;/&lt;/span&gt;&lt;span&gt;StructureMap&lt;/span&gt;&lt;span style="color:blue;"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;Here’s some of the configuration for the other services that the entire EditAddressController needs:&lt;/p&gt;  &lt;div style="border:thin solid black;background:white none repeat scroll 0% 50%;font-size:10pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:black;font-family:courier new;"&gt;   &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForRequestedType&amp;lt;&lt;span&gt;IValidator&lt;/span&gt;&amp;gt;().TheDefaultIsConcreteType&amp;lt;&lt;span&gt;Validator&lt;/span&gt;&amp;gt;();&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForRequestedType&amp;lt;&lt;span&gt;IRepository&lt;/span&gt;&amp;gt;().TheDefaultIsConcreteType&amp;lt;&lt;span&gt;Repository&lt;/span&gt;&amp;gt;().CacheBy(&lt;span&gt;InstanceScope&lt;/span&gt;.Hybrid);&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForRequestedType&amp;lt;&lt;span&gt;PersistenceModel&lt;/span&gt;&amp;gt;().TheDefaultIsConcreteType&amp;lt;&lt;span&gt;DovetailPersistenceModel&lt;/span&gt;&amp;gt;();&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;At no point did I specify that &lt;font face="Courier New"&gt;EditAddressController&lt;/font&gt; needs an &lt;font face="Courier New"&gt;IRepository&lt;/font&gt; that needs an &lt;font face="Courier New"&gt;ISessionSource&lt;/font&gt; that needs 2-3 other things, but yet when I call:&lt;/p&gt;  &lt;div style="border:thin solid black;background:white none repeat scroll 0% 50%;font-size:10pt;-moz-background-clip:-moz-initial;-moz-background-origin:-moz-initial;-moz-background-inline-policy:-moz-initial;color:black;font-family:courier new;"&gt;   &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:green;"&gt;// Creates an AddressEditController with all of its dependencies&lt;/span&gt;&lt;/p&gt;    &lt;p style="margin:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span&gt;AddressEditController&lt;/span&gt; controller = &lt;span&gt;ObjectFactory&lt;/span&gt;.GetInstance&amp;lt;&lt;span&gt;AddressEditController&lt;/span&gt;&amp;gt;();&lt;/p&gt; &lt;/div&gt;  &lt;p&gt;StructureMap will construct &lt;font face="Courier New"&gt;EditAddressController&lt;/font&gt; that had a new instance of &lt;font face="Courier New"&gt;Repository&lt;/font&gt; that had a new instance of &lt;font face="Courier New"&gt;SessionSource&lt;/font&gt; that had an &lt;font face="Courier New"&gt;IDictionary&amp;lt;string, string&amp;gt;&lt;/font&gt; object and a new instance of &lt;font face="Courier New"&gt;DovetailPersistenceModel&lt;/font&gt;.&amp;nbsp; I don’t have to explicitly tell StructureMap to do that for me because it uses its “Auto Wiring” feature to examine the dependencies of each concrete class and act accordingly.&amp;nbsp; StructureMap does need to know what to do with each type of object it encounters.&amp;nbsp; When it tries to build the &lt;font face="Courier New"&gt;Repository&lt;/font&gt; class StructureMap sees the constructor argument for &lt;font face="Courier New"&gt;ISessionSource&lt;/font&gt; on &lt;font face="Courier New"&gt;Repository&lt;/font&gt;, and knows to build and inject a new &lt;font face="Courier New"&gt;SessionSource&lt;/font&gt; object (and so on as deep as you need to go).&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=180005" width="1" height="1"&gt;</description><category domain="http://codebetter.com/blogs/jeremy.miller/archive/tags/StructureMap/default.aspx">StructureMap</category></item><item><title>The all positive post</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/27/the-all-positive-post.aspx</link><pubDate>Fri, 27 Jun 2008 17:03:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179904</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>21</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179904</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/27/the-all-positive-post.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;m a month into our new project and working with a lot of new technologies.&amp;nbsp; When I moved from the desktop back to the web I got some condolences from friends, but it&amp;#39;s always fun to do different things and web development with .Net is much different than when I left.&amp;nbsp; I thought I&amp;#39;d take a timeout from the EF controversy and mention the things that I do like:&lt;/p&gt;&lt;ul&gt;&lt;li&gt;Doing backend development&amp;nbsp; with .Net again.&amp;nbsp; It was interesting(?) to do server side Java last year, but I&amp;#39;m happy to be back.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;Linq for NHibernate.&amp;nbsp; We&amp;#39;re not pushing it that hard, but it&amp;#39;s doing everything I wanted it for.&amp;nbsp; We&amp;#39;re setup to swap out our normal Repository with an InMemoryRepository that relies on Linq to Objects behind the scenes.&amp;nbsp; I think that&amp;#39;s going to end up being huge for testability.&amp;nbsp; I really like being able to put the query logic directly into business layer code instead of being hidden away deep in the bowels of one off Repositories or services -- without sacrificing testability in the domain and service layers.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;jQuery is amazing.&amp;nbsp; The whole &amp;quot;unobtrusive JavaScript&amp;quot; thing is brilliant.&amp;nbsp; I was a JavaScript whiz in the early days of IE 4 &amp;amp; 5, but the elegance of the jQuery solution for tabs as an example, blows away the drudgery of my old JavaScript TabManager class.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;We&amp;#39;re utilizing some of the new stuff in RhinoMocks 3.5.&amp;nbsp; I love some of the new features like the Arrance, Act, and Assert style testing.&amp;nbsp; We&amp;#39;ve started writing some of our own specific BDD style context superclasses for testing Controllers in the MVC framework, and the new RhinoMocks plays very well into this strategy.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;BDD.&amp;nbsp; I resisted it for awhile because, quoting a friend who shall remain nameless, &amp;quot;TDD, but with &amp;#39;Should&amp;#39; instead of &amp;#39;Assert.&amp;#39;&amp;quot;&amp;nbsp; Ok, the shift to &amp;quot;Should&amp;quot; from &amp;quot;Assert&amp;quot; is actually worthy on its own merit, but I think BDD and its concentration on semantics and context is a better way to organize and express tests (specifications).&amp;nbsp; I even think that BDD does really help in the design process.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;The ASP.NET MVC framework is okay.&amp;nbsp; I didn&amp;#39;t like the way it did some things, and I think the testability out of the box isn&amp;#39;t what it could be.&amp;nbsp; However, it was an easy matter to write our own infrastructure on top of the MVC that took the testability pain and some repetitive grunt work away.&amp;nbsp; The fact that it was not only possible, but easy to change its behavior is a major point in the positive column for me on MVC.&amp;nbsp; I love that you can get the code for it too.&amp;nbsp; I don&amp;#39;t think we could have rapidly done the things we did if all we had was Reflector.&amp;nbsp; The things in the MVC that I&amp;#39;m still unhappy with I would blame on ASP.NET in general rather than the MVC itself.&amp;nbsp; &lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;QUnit for JavaScript unit testing.&amp;nbsp; Very cool, and a touch easier to use than jsUnit.&amp;nbsp; I love the model.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;WatiN for web testing.&amp;nbsp; We&amp;#39;re gambling a bit that its FireFox support is going to be satisfactory, but otherwise, I think WatiN has been exceptionally smooth to use.&amp;nbsp; The fact that it&amp;#39;s callable from .Net code is letting us do some Lambda-fu to closely hook up our tests to the underlying model of the web pages.&lt;br /&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;C# 3.5.&amp;nbsp; We&amp;#39;re barely using Linq, but all the features they stuck in there to support Linq are making a huge splash in our code.&amp;nbsp; There are so many times when a judicious extension method eliminates some grunt work or makes code easier to read.&amp;nbsp; Lambda expressions make a lot of code declarative.&amp;nbsp; Object initializers tighten up the code and make unit testing more efficient.&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179904" width="1" height="1"&gt;</description></item><item><title>I'm speaking at Agile Austin on Tuesday </title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/27/i-m-speaking-at-agile-austin-on-tuesday.aspx</link><pubDate>Fri, 27 Jun 2008 14:02:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179897</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>0</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179897</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/27/i-m-speaking-at-agile-austin-on-tuesday.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;m giving a talk this coming Tueday at &lt;a href="http://agileaustin.org/"&gt;Agile Austin&lt;/a&gt; on &amp;quot;How does design get done on an Agile Project?&amp;quot; that&amp;#39;s free to everyone.&amp;nbsp; I&amp;#39;ll post the slides here afterwards.&amp;nbsp; See you there.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;From the website:&amp;nbsp;&lt;/p&gt;&lt;div style="margin:4pt 0in 0pt;"&gt;&lt;strong&gt;&lt;span style="font-size:10pt;"&gt;Description&lt;span style="color:black;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div style="margin:4pt 0in 0pt;"&gt;&lt;font size="2"&gt;Agile projects have a
reputation in many circles as cowboy coding or purely “code n’fix.”&amp;nbsp;
While there might not be an explicitly defined “Architecture” or
“Design” phase or activity, design is still an integral part of any
successful Agile project.&amp;nbsp; This talk will discuss the questions of
when, how, and by whom is design accomplished. &amp;nbsp;Jeremy will present the
Agile and Lean design philosophies for simple design, delayed
commitment, and enabling change.&amp;nbsp; Specifically, he will talk about
enabling Continuous Design, why evolutionary design adds value over
strictly upfront design, and how to get it done without incurring
unnecessary code and design thrash in later stages of the project.&amp;nbsp;This
talk will be useful to all roles on agile project and product efforts,
including project and program managers as well because it touches on
flexible and incremental delivery&lt;/font&gt;&lt;/div&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179897" width="1" height="1"&gt;</description></item><item><title>Spicing up our NHibernate Fluent Interface with pluggable conventions</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/25/spicing-up-our-nhibernate-fluent-interface-with-pluggable-conventions.aspx</link><pubDate>Wed, 25 Jun 2008 20:46:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179787</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>10</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179787</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/25/spicing-up-our-nhibernate-fluent-interface-with-pluggable-conventions.aspx#comments</comments><description>&lt;p&gt;I&amp;#39;m adding pluggable type conventions to our &lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2008/06/18/working-faster-and-fewer-mapping-errors-with-nhibernate.aspx"&gt;NHibernate mapping Fluent Interface&lt;/a&gt; today:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;pre class="code" name="c-sharp"&gt;    public interface ITypeConvention&lt;br /&gt;    {&lt;br /&gt;        bool CanHandle(Type type);&lt;br /&gt;        void AlterMap(IProperty property);&lt;br /&gt;        &lt;br /&gt;    }&lt;br /&gt;&lt;br /&gt;    public interface IProperty&lt;br /&gt;    {&lt;br /&gt;        void AddAlteration(Action action);&lt;br /&gt;        void UseThisType() where T : IUserType;&lt;br /&gt;        void SetAttributeOnPropertyElement(string name, string key);&lt;br /&gt;    }&lt;/pre&gt;&lt;pre class="code" name="c-sharp"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="code" name="c-sharp"&gt;Anyway, one of the design ideas we can steal from Ruby on Rails is the convention over configuration philosophy.  Part of the efficiency gain I think we make by moving from hbm.xml configuration to the FI is taking advantage of conventions tied to object types.  We&amp;#39;ve made the FI smart enough to respond to some class and property types.  The code above is going to make these conventions pluggable.  Today, I&amp;#39;m adding a custom IUserType for our Value Objects.  I&amp;#39;m creating the hook above to plug in a rule that says that any property subclassing type ValueObject will be mapped using this new IUserType.  &lt;/pre&gt;&lt;pre class="code" name="c-sharp"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="code" name="c-sharp"&gt;Here&amp;#39;s some examples of conventions:&amp;nbsp;&lt;/pre&gt;&lt;ul&gt;&lt;li&gt;&lt;pre class="code" name="c-sharp"&gt;You&amp;#39;re trying to create a mapping for a class that subclasses DomainEntity?  Why don&amp;#39;t I just automatically set up the identifier node for you pointing to the Id property.  I&amp;#39;ll add property mappings for all those common audit trail columns too.&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;&lt;pre class="code" name="c-sharp"&gt;You got an enumeration type?  I&amp;#39;ll just stick in an EntityStringType for you.&lt;/pre&gt;&lt;/li&gt;&lt;/ul&gt;&lt;pre class="code" name="c-sharp"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="code" name="c-sharp"&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre class="code" name="c-sharp"&gt;More results, less code, and fewer lines of XmHell. &lt;/pre&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;


&lt;pre class="code" name="c-sharp"&gt;&lt;br /&gt;&lt;/pre&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179787" width="1" height="1"&gt;</description><category domain="http://codebetter.com/blogs/jeremy.miller/archive/tags/Database+and+Persistence/default.aspx">Database and Persistence</category></item><item><title>Does our addiction on visual tooling harm the rate of innovation in the .Net world?</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/24/does-our-addiction-on-visual-tooling-harm-the-rate-of-innovation-in-the-net-world.aspx</link><pubDate>Wed, 25 Jun 2008 03:41:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179709</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>45</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179709</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/24/does-our-addiction-on-visual-tooling-harm-the-rate-of-innovation-in-the-net-world.aspx#comments</comments><description>&lt;p&gt;Here&amp;#39;s a peripheral argument to the current EF ruckus:&amp;nbsp; Is the focus on visual tooling hindering the rate of innovation in the .Net world?&amp;nbsp; At the ALT.NET event in Seattle, we started with a fishbowl session on polyglot programming (basically, using different languages and even writing little languages for the particular tasks that they&amp;#39;re best suited for).&amp;nbsp; One of the attendees thought polyglot programming was a bad idea because of all the tooling that each new language was going to require.&amp;nbsp; True, but hopefully false.&amp;nbsp; High ceremony languages like C# and Java require more tooling like ReSharper and IntelliJ to be efficient than lower ceremony languages or terser languages.&amp;nbsp; What if the alternative languages were usable for some specialized task without a lot of new tooling?&amp;nbsp; Think about scripting languages or external DSL&amp;#39;s that are tuned for specific purposes and really don&amp;#39;t require Intellisense and wizardry to be useful.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Think about it, visual tools and user interfaces are expensive to build, but yet we automatically assume that a tool is &amp;quot;better&amp;quot; if it comes with Visual Studio integration and other visual goodies.&amp;nbsp; Part of the cost of anything new Microsoft builds is a wizard tool or a VS plugin.&amp;nbsp; That cost inevitably detracts from the development of whatever framework or technology that the wizard is meant to help.&amp;nbsp; It&amp;#39;s an idle thought, but what if the Entity Framework team had focused on a textual DSL tool for configuration and modeling that was easy to use instead of relying on the more mechanically expensive designers?&amp;nbsp; Or made the Xml mapping simple enough that you didn&amp;#39;t feel like the designer was necessary?&amp;nbsp; Is it possible that they would have had more than enough time to make the structural changes in EF to allow for a Persistence Ignorance option in the first rollout?&amp;nbsp; Instead of the wasteful arguments about the design of EF, I might be a happy, card carrying member of the &amp;quot;Entity Framework Mafia.&amp;quot;&lt;br /&gt;&lt;/p&gt;All I&amp;#39;m really trying to say is that I think we could gain some benefits by downgrading our reliance on visual tooling and software factories and Visual Studio plugins in favor of API&amp;#39;s that are terser, easier to read, and easier to consume.&amp;nbsp;&amp;nbsp; My thesis is mostly based on my belief that language oriented programming techniques will often provide a greater return on investment than the comparable effort to develop visual tooling.&amp;nbsp; Or we could just concentrate on making better API&amp;#39;s I suppose.&lt;br /&gt;&lt;p&gt;As an aside, a couple years ago I spent quite a bit of time trying to write a user interface tool to help users write the StructureMap Xml configuration.&amp;nbsp; It was a mountain of work, and I gave up after becoming discouraged by the number of edge cases I needed to handle in the UI.&amp;nbsp; A couple releases later I focused on DRY&amp;#39;ing up the Xml configuration to streamline it, bulked up the diagnostics, and added the Fluent Interface style of configuration.&amp;nbsp; I&amp;#39;d argue that the Fluent Interface and Xml configuration improvements did enough to make the configuration easier that the UI tool is completely unnecessary.&amp;nbsp; I certainly haven&amp;#39;t felt like I&amp;#39;ve needed it in my daily work.&amp;nbsp; Now, I&amp;#39;d really like to get that very nice, early September day I wasted trying to write my StructureMap wizard instead of site seeing on the &amp;quot;Miracle Mile&amp;quot; in Chicago and going to the Field Museum.&amp;nbsp; Priorities.&lt;/p&gt;&lt;p&gt;That last paragraph is partially meant as a warning for the Unity
team because they&amp;#39;ve got a visual editor on their CodePlex release plan.&amp;nbsp; Trust me guys, there&amp;#39;s better ways to add value to Unity than
spending the necessary resources to write a visual wizard to write configuration. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;A year or so ago (I couldn&amp;#39;t find the link), &lt;a href="http://ayende.com/blog"&gt;Ayende&lt;/a&gt; made the statement that any framework that required a wizard must have a terrible API.&amp;nbsp; Assuming that he really did say that, and I&amp;#39;m not making that up, ditto from me.&amp;nbsp; Don&amp;#39;t believe me?&amp;nbsp; Pick any of the bigger 3rd party WinForms control libraries and try to configure their grid control without a designer.&amp;nbsp; &lt;/p&gt;&lt;p&gt;One of my beefs about WPF (I do actually like WPF overall) is that the Xaml markup and object structure is clearly optimized for tooling rather than programmatic usage.&amp;nbsp; It&amp;#39;s certainly possible to do dynamic layouts and DSL things with WPF, but it&amp;#39;s clearly not the way WPF is meant to be used and it showed.&amp;nbsp; That&amp;#39;s really too bad because the actual technology behind the scenes seemed to be rock solid (once we wrote our Fluent Interface for dynamic forms it worked very well).&lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;Just think, if we weren&amp;#39;t spending so much time as a community trying to build visual tools to make up for bad API design, how much more time we could have for &amp;quot;is the var keyword the work of the devil, or merely an occasional way to make code more readable?&amp;quot;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Now discuss.&amp;nbsp;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179709" width="1" height="1"&gt;</description></item><item><title>StructureMap 2.4.9 Preview Release is available</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/23/structuremap-2-4-9-preview-release-is-available.aspx</link><pubDate>Mon, 23 Jun 2008 18:17:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179640</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>14</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179640</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/23/structuremap-2-4-9-preview-release-is-available.aspx#comments</comments><description>&lt;p&gt;A preview release of StructureMap 2.5 is available now at &lt;a href="http://sourceforge.net/projects/structuremap"&gt;http://sourceforge.net/projects/structuremap&lt;/a&gt;.&amp;nbsp; The code is completely baked (minus some convenience methods I&amp;#39;m going to throw in), but I&amp;#39;m lagging on the documentation (life has been intruding on my side project time lately).&amp;nbsp; I&amp;#39;ll make the full and official release as soon the documentation is done.&amp;nbsp; This release marks a large scale re-architecture of StructureMap and has taken it very far from its roots as a simple tool to build objects from an Xml representation.&amp;nbsp; As such, I&amp;#39;m completely rewriting the documentation and website as well.&amp;nbsp; I&amp;#39;m hoping to include quite a few samples of usage.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;The new functionality in StructureMap 2.5:&lt;/p&gt;&lt;p&gt;* The ability to use StructureMap with ZERO Xml or attributes by default&amp;nbsp;&lt;/p&gt;&lt;p&gt;* The ability to add services at runtime.&amp;nbsp; You can now programmatically add an entire Assembly at runtime for modular applications that might not want all services to be loaded at startup.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;* An auto mocking container based on Rhino Mocks 3.5.&amp;nbsp; I was a doubter on the validity of AMC, but I&amp;#39;m sold now that I&amp;#39;ve used it&amp;nbsp;&lt;/p&gt;&lt;p&gt;* More sophisticated auto wiring rules&lt;br /&gt;&lt;/p&gt;&lt;p&gt;* Supporting NameValueCollection and IDictionary&amp;lt;Key, Value&amp;gt; types&lt;/p&gt;&lt;p&gt;* Far more extensibility&lt;/p&gt;&lt;p&gt;* Interception and post processing hooks for you AOP enthusiasts.&amp;nbsp; StructureMap will NOT include its own AOP engine, but will allow you to use the runtime AOP technique of your choice.&lt;/p&gt;&lt;p&gt;* More configuration options in both Xml and the Fluent Interface.&amp;nbsp; Usability tweaks for the Fluent Interface.&lt;br /&gt;&lt;/p&gt;&lt;p&gt;* More options for modular configuration (mix and match Xml configuration or Registry&amp;#39;s at will) -- which basically had to trigger:&lt;/p&gt;&lt;p&gt;* Completely revamped diagnostics, including the Environment Testing support &lt;br /&gt;&lt;/p&gt;&lt;p&gt;* Transparent creation of concrete types that are not explicitly registered&lt;/p&gt;&lt;p&gt;* Create objects with explicit arguments passed to the container&lt;/p&gt;&lt;p&gt;* Use the underlying Container independently of ObjectFactory&lt;/p&gt;&lt;p&gt;* Pluggable auto registration&lt;/p&gt;&lt;p&gt;* StructureMap is now strong named (thanks to Steve Harman)&lt;/p&gt;&lt;p&gt;* Pull configuration from the App.config (thanks to Josh Flanagan)&lt;/p&gt;&lt;p&gt;* Generics fixes (thanks to Derrick Rapp)&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;Anyway, I&amp;#39;ve got some documentation to go write....&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179640" width="1" height="1"&gt;</description><category domain="http://codebetter.com/blogs/jeremy.miller/archive/tags/StructureMap/default.aspx">StructureMap</category></item><item><title>It's either puke worthy or elegant</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/19/it-s-either-puke-worthy-or-elegant.aspx</link><pubDate>Thu, 19 Jun 2008 20:20:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179503</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>32</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179503</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/19/it-s-either-puke-worthy-or-elegant.aspx#comments</comments><description>&lt;pre class="code" name="c-sharp"&gt;protected static T redirectTo&amp;lt;T, CONTROLLER&amp;gt;(Expression&amp;lt;Func&amp;lt;CONTROLLER, object&amp;gt;&amp;gt; expression) where T : ViewModel, new()&lt;br /&gt;{&lt;br /&gt;        return new T() {Override = new ControllerRedirectResult&amp;lt;CONTROLLER&amp;gt;(expression)};&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;
&lt;p&gt;Just a wee bit of code we&amp;#39;re using in our MVC Controller base class.&amp;nbsp; I&amp;#39;m happy with what it *does,* but tell me that isn&amp;#39;t butt ugly code.&amp;nbsp; I think the angle bracket and generic constraint noise tax is like the governor on school buses that keeps them from going over 65 miles an hour.&amp;nbsp; Anders&amp;#39; way of telling you that you&amp;#39;re going too far and time to back off.&amp;nbsp; Anyway, the usage of the stuff above isn&amp;#39;t that bad, and the unit testing is pretty easy.&lt;/p&gt;&lt;p&gt;Comments are welcome.&amp;nbsp; This kind of thing bothers me in the sense that later developers are gonna scream WTF! when they find it in the code.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179503" width="1" height="1"&gt;</description></item><item><title>Working faster and fewer mapping errors with NHibernate</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/18/working-faster-and-fewer-mapping-errors-with-nhibernate.aspx</link><pubDate>Thu, 19 Jun 2008 02:41:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179450</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>24</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179450</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/18/working-faster-and-fewer-mapping-errors-with-nhibernate.aspx#comments</comments><description>EDIT:&amp;nbsp; To access the codebase below, the user name is &amp;quot;guest&amp;quot; and the password is blank.&amp;nbsp; &lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2008/02/01/access-to-the-storyteller-source-code.aspx"&gt;http://codebetter.com/blogs/jeremy.miller/archive/2008/02/01/access-to-the-storyteller-source-code.aspx&lt;/a&gt;    
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Yesterday,
            &lt;a href="http://codebetter.com/blogs/david_laribee/archive/2008/06/17/test-your-nhibernate-mappings.aspx"&gt;David Laribee related some problems&lt;/a&gt; he experienced with refactorings in his 
            domain model leading to some breaking problems with NHibernate mappings.&amp;nbsp; 
            Specifically, the issues are:&lt;/p&gt;
    
&lt;ol&gt;
        
&lt;li&gt;Changing the property names of a domain model can break the NHibernate mapping&lt;/li&gt;
        
&lt;li&gt;Changing the database fields can break the NHibernate mappings&lt;/li&gt;
    &lt;/ol&gt;
    
&lt;p&gt;
        David went on to bemoan the absence of a quick way to validate NHibernate 
        mappings.&amp;nbsp; Ayende popped in with the suggestion that the presence of 
        integrated tests around the NHibernate usage would spot mapping problems.&amp;nbsp; 
        Other folks mentioned that there&amp;#39;s a new ReSharper plugin to validate and 
        refactor NHibernate mappings.&amp;nbsp; I&amp;#39;ll circle back to the refactoring plugin 
        in a while.&amp;nbsp; &lt;/p&gt;
&lt;p&gt;First I want to talk about quick ways to validate NHibernate 
        mappings.&amp;nbsp; Ayende is right of course about the integrated tests against the 
        individual queries, but I&amp;#39;m going to suggest that that isn&amp;#39;t the most efficient 
        answer to the question of validating the mappings.&amp;nbsp; The bigger integration tests will tell you that something is 
        wrong, but from experience they&amp;#39;ll be harder to diagnose because there is so 
        much more going on than simple property checking, and they provide a slow 
        feedback cycle because of how much stuff is going on.&amp;nbsp; What would be nice 
        is a way to walk right up to a mapping and specify which properties on a class 
        are supposed to be persisted and how.&lt;/p&gt;
    
&lt;p&gt;
        I thought I would come out of my blogging retirement and show an example of the
        &lt;a href="http://www.lostechies.com/blogs/chad_myers/archive/2008/06/02/a-new-start.aspx"&gt;Chad and Jeremy&lt;/a&gt; 
        approach to testing NHibernate mappings:&lt;/p&gt;
        
&lt;pre name="code" class="c-sharp"&gt;        

        [SetUp]
        public void SetUp()
        {
            // Ensure that the StructureMap configuration is bootstrapped
            // In our case, this includes everything we need setup to 
            // execute NHibernate (mappings + ISessionFactory configuration)
            // This will be pretty application specific here
            Bootstrapper.RestartStructureMap();
        }
        
        [Test]
        public void SaveAndLoadCustomerContact()
        {
            new PersistenceSpecification&amp;lt;CustomerContact&amp;gt;()
                .CheckProperty(x =&amp;gt; x.Name, &amp;quot;Frank&amp;quot;)
                .CheckProperty(x =&amp;gt; x.Email, &amp;quot;Email&amp;quot;)
                .CheckProperty(x =&amp;gt; x.Extension, 123)
                .CheckProperty(x =&amp;gt; x.FaxNumber, &amp;quot;111-111-1111&amp;quot;)
                .CheckProperty(x =&amp;gt; x.TelephoneNumber, &amp;quot;222-222-2222&amp;quot;)
                .CheckProperty(x =&amp;gt; x.Title, &amp;quot;Mr.&amp;quot;)
                .VerifyTheMappings();
        }
        &lt;/pre&gt;
        
&lt;p&gt;
            All this test does is ensure that the 6 properties of the CustomerContact class 
            (Name, Email, Extension, FaxNumber, TelephoneNumber, Title) are mapped in 
            NHibernate.&amp;nbsp; We have some other methods for checking to many and many to 
            one type relationships.&amp;nbsp; &lt;/p&gt;
        
&lt;p&gt;
            Behind the scenes the PersistenceSpecification&amp;lt;T&amp;gt; class:&lt;/p&gt;
    
&lt;ol&gt;
        
&lt;li&gt;&amp;nbsp;Creates a new instance of T&lt;/li&gt;
        
&lt;li&gt;Uses the lambda expressions and suggested values in the calls to CheckProperty 
            to load values into the new instance of T&lt;/li&gt;
        
&lt;li&gt;Grabs our IRepository out of StructureMap (of course), and saves the object&lt;/li&gt;
        
&lt;li&gt;Grabs a second IRepository out of StructureMap&lt;/li&gt;
        
&lt;li&gt;Fetches a second copy of the same T out of the second IRepository&lt;/li&gt;
        
&lt;li&gt;Verifies that all of the specified properties in the specification were saved 
            and loaded.&amp;nbsp; If any single property does not match between the first T and 
            the second T, the test will fail.&lt;/li&gt;
    &lt;/ol&gt;
    
&lt;p&gt;Here&amp;#39;s the implementation of the PersistenceSpecification.VerifyTheMappings() method:&lt;/p&gt;
    
&lt;pre name="code" class="c-sharp"&gt;        public void VerifyTheMappings()
        {
            // Create the initial copy
            var first = new T();

            // Set the &amp;quot;suggested&amp;quot; properties, including references
            // to other entities and possibly collections
            _allProperties.ForEach(p =&amp;gt; p.SetValue(first));

            // Save the first copy
            _repository.Save(first);

            // Get a completely different IRepository
            var secondRepository = createRepository();

            // &amp;quot;Find&amp;quot; the same entity from the second IRepository
            var second = secondRepository.Find&amp;lt;T&amp;gt;(first.Id);

            // Validate that each specified property and value
            // made the round trip
            // It&amp;#39;s a bit naive right now because it fails on the first failure
            _allProperties.ForEach(p =&amp;gt; p.CheckValue(second));
        }
    &lt;/pre&gt;
    
    
&lt;p&gt;The advantage of this testing is that it gives a (relatively) fast feedback cycle 
        focused specifically on the mappings.&amp;nbsp; Tools that check the hbm.xml 
        mappings can only verify that what&amp;#39;s there is correctly formed.&amp;nbsp; The 
        mapping tests above will catch missing mappings and desired behavior.&amp;nbsp; At a 
        bare minimum, you really should have at least one smoke test in your CI build 
        that simply tries to create an NHibernate ISession object from your 
        configuration.&amp;nbsp; Let that test run and possibly fail the build before wasting any time on integrated 
        tests that can&amp;#39;t succeed.&lt;/p&gt;
    
&lt;p&gt;Now, the ReSharper plugin for NHibernate sounds pretty cool.&amp;nbsp; I definitely 
        want little or no friction in renaming or adding properties in my Domain Model 
        classes (why I absolutely despise codegen your business object solutions).&amp;nbsp; 
        We beat the refactoring problem by eliminating HBM.XML.&amp;nbsp; As part of my New 
        Year&amp;#39;s resolution to eliminate my exposure to angle bracket hell, we&amp;#39;ve created 
        the beginning of a Fluent Interface API to express NHibernate mappings.&amp;nbsp; 
        Using copious amounts of Generics (I guess .Net code just &amp;quot;wants&amp;quot; to have lots 
        of angle brackets) and lambda expressions, we&amp;#39;re able to express NHibernate 
        mappings in a completely compiler-checked, ReSharper-able way.&amp;nbsp; Since we 
        switched to the FI, we&amp;#39;ve experienced far less trouble with mapping problems.&amp;nbsp; 
        Here&amp;#39;s a couple of examples:&lt;/p&gt;
        
        
&lt;pre name="code" class="c-sharp"&gt;    // Simple class with properties and a single &amp;quot;to-many&amp;quot; relationship
    public class CustomerContactMap : ClassMap&amp;lt;CustomerContact&amp;gt;
    {
        public CustomerContactMap()
        {
            Map(x =&amp;gt; x.Name);
            Map(x =&amp;gt; x.Email);
            Map(x =&amp;gt; x.Extension);
            Map(x =&amp;gt; x.FaxNumber);
            Map(x =&amp;gt; x.TelephoneNumber);
            Map(x =&amp;gt; x.Title);
            References(x =&amp;gt; x.Customer);
        }
    }
    
    // Class with a &amp;quot;Component&amp;quot;
    public class CustomerDeliveryAddressMap : ClassMap&amp;lt;CustomerDeliveryAddress&amp;gt;
    {
        public CustomerDeliveryAddressMap()
        {
            Map(x =&amp;gt; x.Name);
            References(x =&amp;gt; x.Customer);
            Component&amp;lt;Address&amp;gt;(x =&amp;gt; x.Address, m =&amp;gt;
               {
                   m.Map(x =&amp;gt; x.AddressLine1);
                   m.Map(x =&amp;gt; x.AddressLine2);
                   m.Map(x =&amp;gt; x.AddressLine3);
                   m.Map(x =&amp;gt; x.CityName);
                   m.Map(x =&amp;gt; x.CountryName);
                   m.References(x =&amp;gt; x.State);
                   m.References(x =&amp;gt; x.PostalCode);
               });
        }
    }
    
    // Class with some &amp;quot;has many&amp;quot; relationships
    public class CustomerMap : ClassMap&amp;lt;Customer&amp;gt;
    {
        public CustomerMap()
        {
            HasMany&amp;lt;CustomerContact&amp;gt;(x =&amp;gt; x.Contacts).CascadeAll();
            HasMany&amp;lt;CustomerJob&amp;gt;(x =&amp;gt; x.Jobs).CascadeAll();
            HasMany&amp;lt;CustomerDeliveryAddress&amp;gt;(x =&amp;gt; x.DeliveryAddresses).CascadeAll();

            Map(x =&amp;gt; x.Name);
            Map(x =&amp;gt; x.LookupName);
            Map(x =&amp;gt; x.IsGeneric);
            Map(x =&amp;gt; x.RequiresPurchaseOrder);
            Map(x =&amp;gt; x.Retired);
        }
    }
    
    
        &lt;/pre&gt;
        
    
&lt;p&gt;With this approach, and backed up with the little PersistenceSpecification tests, 
        we can happily change class names and property names with relative confidence.&amp;nbsp; 
        Besides, the simple usage of Intellisense plus compiler safe code cuts down on 
        the number of mapping errors.&amp;nbsp; We&amp;#39;re more or less greenfield at the moment, so we can get away with generating 
        the database from our NHibernate mappings on demand, but you can specify 
        specific table and column names in the language above for brownfield scenarios.&amp;nbsp; 
        I&amp;#39;d very confidently say that we&amp;#39;re faster with this approach than we would be 
        with HBM.XML.&lt;/p&gt;
    
&lt;p&gt;If you&amp;#39;re interested, the complete code for everything I talked about is in the ShadeTree.DomainModel project in the StoryTeller codebase (and effectively released under the Apache 2.0 license).  The code is at
        &lt;a href="http://storyteller.tigris.org/svn/storyteller/trunk"&gt;http://storyteller.tigris.org/svn/storyteller/trunk/&lt;/a&gt;.  Use the src\ShadeTree.sln for this stuff.  I don&amp;#39;t know that we&amp;#39;ll ever get around to a fully supported release of this stuff, but I wanted to throw out the idea anyway.  At this point I&amp;#39;m only extending this code when we need something new for our current project.&amp;nbsp; 
        A lot of the advantages of this approach are tied to application specific 
        conventions and also by tieing the forward generation of the database structure 
        to validation rules.&lt;/p&gt;
    
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
    
    &lt;h4&gt;As for IoC container testing... &lt;/h4&gt;
    
&lt;p&gt;I&amp;#39;ll overlook the fact that my friend David also implicitly implied that an 
        IoC container not named StructureMap was the de facto standard.
        &lt;a href="http://weblogs.asp.net/bsimser/archive/2008/06/04/the-first-spec-you-should-write-when-using-castle.aspx"&gt;Bil Simser posted a little snippet of code to smoke test the configuration&lt;/a&gt; of one of those other IoC containers.&amp;nbsp; StructureMap has had quite a bit 
        of diagnostic support since version 0.85 (StructureMapDoctor.exe), but StructureMap 2.5 will add the 
        ability to do this:&lt;/p&gt;
        
&lt;pre name="code" class="c-sharp"&gt;        [SetUp]
        public void SmokeTestStructureMapConfiguration()
        {
            ObjectFactory.AssertConfigurationIsValid();
        }
        &lt;/pre&gt;
        
&lt;p&gt;This will attempt to build every possible configured instance in StructureMap, perform any designated 
            &lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2006/04/06/142431.aspx"&gt;environment tests&lt;/a&gt; (like trying to connect to a database), and generate a &lt;b&gt;complete&lt;/b&gt; report of all errors encountered by StructureMap.&amp;nbsp; 
            If you&amp;#39;re aggressive about managing all external services and configuration into your IoC container, this diagnostic 
            test can go a long way towards detecting environmental and configuration errors of a code installation.&lt;/p&gt;
&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179450" width="1" height="1"&gt;</description><category domain="http://codebetter.com/blogs/jeremy.miller/archive/tags/Database+and+Persistence/default.aspx">Database and Persistence</category><category domain="http://codebetter.com/blogs/jeremy.miller/archive/tags/StructureMap/default.aspx">StructureMap</category></item><item><title>A bad argument</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/16/a-bad-argument.aspx</link><pubDate>Mon, 16 Jun 2008 18:46:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179344</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>6</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179344</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/16/a-bad-argument.aspx#comments</comments><description>&lt;p&gt;I browsed blogs for the first time in a couple weeks the other day.&amp;nbsp; Somewhere in a static typed vs dynamic typed languages argument post some clown said (paraphrasing), &amp;quot;we don&amp;#39;t need no stinkin&amp;#39; Ruby because we can do metaprogramming in C# with IL generation.&amp;quot;&amp;nbsp; Yeah you can, and I have as a matter of fact, but it&amp;#39;s painful and not even remotely time effective for anything but highly reusable, simple code.&amp;nbsp; I started to say in a conversation today that the author of that statement should be beaten with a stick for that comment, but seeing as the author was obviously a masochist, that seemed like sending the wrong type of signal.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179344" width="1" height="1"&gt;</description></item><item><title>StructureMap 2.5 will be released on June 23rd</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/11/structuremap-2-5-will-be-released-on-june-23rd.aspx</link><pubDate>Wed, 11 Jun 2008 19:25:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179208</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>13</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179208</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/11/structuremap-2-5-will-be-released-on-june-23rd.aspx#comments</comments><description>&lt;p&gt;Several people have asked, and I&amp;#39;m getting anxious to get it out.&amp;nbsp; I&amp;#39;ve got just a couple little coding tasks to do, then about a week of writing docs, examples, and tutorial thingies.&amp;nbsp; I originally planned to make this release in .Net 2.0, but I gave in and switched the code over to .Net 3.5.&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179208" width="1" height="1"&gt;</description></item><item><title>I'm maturing as a developer</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/11/i-m-maturing-as-a-developer.aspx</link><pubDate>Wed, 11 Jun 2008 16:59:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:179206</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=179206</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/06/11/i-m-maturing-as-a-developer.aspx#comments</comments><description>&lt;p&gt;Yesterday I sat down in the morning to spike something with the new ASP.NET MVC thingie.&amp;nbsp; I was going to adapt a Javascript grid I wrote a couple years ago with Prototype and repurpose that code for the new requirements.&amp;nbsp; After 5 minutes of googling, I ditched my code and went with some off the shelf jQuery plugins, and promptly found some other plugins that will serve just fine.&amp;nbsp; Jeremy of 5 years ago would have rolled his own. &lt;/p&gt;&lt;p&gt;p.s. yeah, jQuery rocks and all, but the jQuery *community* and *project* is what&amp;#39;s totally awesome to me.&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=179206" width="1" height="1"&gt;</description></item><item><title>The Open/Closed Principle on MSDN</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/05/28/the-open-closed-principle-on-msdn.aspx</link><pubDate>Wed, 28 May 2008 21:33:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:178785</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>9</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=178785</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/05/28/the-open-closed-principle-on-msdn.aspx#comments</comments><description>&lt;p&gt;My latest article entitled &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc546578.aspx"&gt;The Open Closed Principle&lt;/a&gt; is available in the &lt;a href="http://msdn.microsoft.com/en-us/magazine/cc515076.aspx"&gt;June 2008 edition of MSDN Magazine&lt;/a&gt;.&amp;nbsp; I tried to present both the motivation for following the OCP and some design strategies (besides the obvious Plugin example) and related principles to bring your design closer to being &amp;quot;Open for Extension, but Closed for Modification.&amp;quot;&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;If you&amp;#39;ve never heard of the Open/Closed Principle, think of doing an addition to an existing house.&amp;nbsp; What sounds easier, laying all new bricks for an all new room, or changing the layout of existing rooms with a reciprocating saw?&amp;nbsp; An Open/Closed design allows us to extend the system with new code instead of having to potentially screw up existing code that works today.&amp;nbsp; &lt;/p&gt;&lt;p&gt;Lastly, if you&amp;#39;ve read about the OCP before and think the OCP == &amp;quot;Plugin Pattern,&amp;quot; go give the article a read, because that&amp;#39;s not the entire story.&lt;/p&gt;&lt;p&gt;This is the first in a bi-monthly series of articles called Patterns in
Practice on software design fundamentals.&amp;nbsp; The next article (Object
Role Stereotypes/Responsibility Driven Design) is already completed, but I&amp;#39;d be perfectly happy to
take requests.&amp;nbsp; I think the next two leading candidates are &amp;quot;design
vectors&amp;quot; (i.e. better designed code by moving in the direction of this, that, or the other) and treating Inversion of Control as a design pattern
independently of IoC tools. &lt;br /&gt;&lt;/p&gt;Related Posts to the Article:&lt;br /&gt;&lt;ul&gt;&lt;li&gt;&lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/09/28/just-some-little-fundamental-things-to-help-you-codebetter.aspx"&gt;Just some little things to help you CodeBetter&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/01/08/Orthogonal-Code.aspx"&gt;Orthogonal Code&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2005/11/07/134359.aspx"&gt;Using the Chain of Responsibility Pattern&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2006/12/06/On-Writing-Maintainable-Code.aspx"&gt;On Writing Maintainable Code&lt;/a&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/10/31/be-not-afraid-of-the-visitor-the-big-bad-composite-or-their-little-friend-double-dispatch.aspx"&gt;Be not afraid of the Visitor Pattern, the big, bad Composite Pattern, or their little friend Double Dispatch&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=178785" width="1" height="1"&gt;</description><category domain="http://codebetter.com/blogs/jeremy.miller/archive/tags/Design+Patterns/default.aspx">Design Patterns</category><category domain="http://codebetter.com/blogs/jeremy.miller/archive/tags/Maintainability/default.aspx">Maintainability</category></item><item><title>We're talking past each other on the Entity Framework</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/05/25/we-re-talking-past-each-other-on-the-entity-framework.aspx</link><pubDate>Sun, 25 May 2008 22:25:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:178685</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>24</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=178685</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/05/25/we-re-talking-past-each-other-on-the-entity-framework.aspx#comments</comments><description>&lt;p&gt;Yeah, I know everyone is tired of the Entity Framework argument, but maybe we can start a real discussion.&amp;nbsp; I&amp;#39;ve seen two very different conversations about the Entity Framework from the data centric folks (pro) and the DDD/TDD/OOP folks (con).&amp;nbsp; It&amp;#39;s not even a real argument, because we&amp;#39;re concerned about very different things that aren&amp;#39;t even in real opposition.&amp;nbsp; I&amp;#39;m completely agnostic about the Entity Data Model and the farther reaching, universal data access goals of the EF.&amp;nbsp; I&amp;#39;m strictly concerned with the EF&amp;#39;s poor applicability for evolutionary design, Domain Driven Design, testability, and separation of concerns.&amp;nbsp; The EF seems to have all the major bases all covered in terms of functionality, it&amp;#39;s just the *way* that it implements this behavior that concerns me.&lt;br /&gt; &lt;/p&gt;&lt;p&gt;&lt;b&gt;The problem with the blogging from last week is that it&amp;#39;s two different conversations!&lt;/b&gt;&amp;nbsp; The &amp;quot;pro-EF&amp;quot; folks seem to be giddy about the functionality and features of the EF.&amp;nbsp; I&amp;#39;m steamed about what I feel to be the &lt;b&gt;poor usability&lt;/b&gt; of the EF.&amp;nbsp; I do fully understand that the EF is about so much more than O/R mapping, I just don&amp;#39;t think that their vision for data access adds more value than the harm that EF will do to my architecture by being intrusive.&amp;nbsp; The cool thing is that the EF team *can* actually make both camps happy.&amp;nbsp; There is absolutely no technical reason that the EF cannot deliver all
of this utopian EDM goodness AND make the necessary structural changes
to allow for real Persistence Ignorance to address my concerns about
its usability.&amp;nbsp; &lt;/p&gt;&lt;p&gt;The only real argument is their priority queue.&amp;nbsp; I obviously think the EF team needs to get a full Persistence Ignorant story in place before adding any other new functionality.&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;p&gt;For the record, I&amp;#39;m somewhat dubious about the actual usefulness of the Entity Data Model, but I will very seriously consider using the Entity Framework the minute that the EF team ships a real Persistence Ignorant option (which HAS to include transparent lazy loading) and a streamlined mapping configuration story (i.e. I want the conceptual model completely hidden away).&amp;nbsp; Until then, all that impressive sounding EDM stuff does not justify what I feel are severe compromises in my application architecture that do not occur with other persistence solutions.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=178685" width="1" height="1"&gt;</description><category domain="http://codebetter.com/blogs/jeremy.miller/archive/tags/Database+and+Persistence/default.aspx">Database and Persistence</category></item><item><title>What Dan Simmons forgot to tell you about the Entity Framework</title><link>http://codebetter.com/blogs/jeremy.miller/archive/2008/05/19/what-dan-simmons-forgot-to-tell-you-about-the-entity-framework.aspx</link><pubDate>Mon, 19 May 2008 20:02:00 GMT</pubDate><guid isPermaLink="false">d21fbbc9-c112-4f32-ad14-95939a2c53d4:178436</guid><dc:creator>Jeremy D. Miller</dc:creator><slash:comments>20</slash:comments><wfw:commentRss xmlns:wfw="http://wellformedweb.org/CommentAPI/">http://codebetter.com/blogs/jeremy.miller/rsscomments.aspx?PostID=178436</wfw:commentRss><comments>http://codebetter.com/blogs/jeremy.miller/archive/2008/05/19/what-dan-simmons-forgot-to-tell-you-about-the-entity-framework.aspx#comments</comments><description>&lt;p&gt;&lt;a href="http://blogs.msdn.com/dsimmons"&gt;Dan Simmons&lt;/a&gt; from the Entity Framework team at Microsoft made &lt;a href="http://blogs.msdn.com/dsimmons/archive/2008/05/17/why-use-the-entity-framework.aspx"&gt;a nice post comparing the Entity Framework to other existing tools&lt;/a&gt;.&amp;nbsp; I wanted to pick a little bone with his comparison to NHibernate.&amp;nbsp; I don&amp;#39;t think he said anything inaccurate, and he was very fair minded, but he left out the crucial fact in any consideration of using NHibernate versus the Entity Framework.&amp;nbsp; The Entity Framework is very intrusive into your application, but NHibernate is not.&amp;nbsp; NHibernate lets me use POCO&amp;#39;s to model the business process in a database agnostic way.&amp;nbsp; The Entity Framework wants me to bake EF infrastructure directly into my business objects.&lt;br /&gt; &lt;/p&gt;&lt;p&gt;The major problem I have with the Entity Framework is very apparent in Dan Simmon&amp;#39;s post.&amp;nbsp; The EF team, and its advocates in the blogosphere, are strictly focused on data.&amp;nbsp; The last I checked, an application, system, or service usually consists of more than just getting data in and out of a database.&amp;nbsp; Some of that other stuff is quite challenging as well.&amp;nbsp; I&amp;#39;d prefer to be able to make that other stuff work in peace without data access infrastructure concerns bleeding into my business classes.&amp;nbsp; &lt;/p&gt;&lt;p&gt;I would really like to challenge the EF team and the EF cheerleaders to be more cognizant of the entire application architecture instead of focusing strictly on the grubby details of data access.&amp;nbsp;&lt;/p&gt;&lt;img src="http://codebetter.com/aggbug.aspx?PostID=178436" width="1" height="1"&gt;</description></item></channel></rss>