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

<channel>
	<title>The Freak Parade &#187; NHibernate</title>
	<atom:link href="http://www.thefreakparade.com/category/orm/nhibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thefreakparade.com</link>
	<description>Strange noises from the mind of Nathan Stults...</description>
	<lastBuildDate>Wed, 28 Oct 2009 01:10:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>So you want to learn NHibernate? (or, NHibernate Hyperlink Acupuncture)</title>
		<link>http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-1-of-1-the-links/</link>
		<comments>http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-1-of-1-the-links/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 22:25:35 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[ORM]]></category>
		<category><![CDATA[Rhino Tools]]></category>

		<guid isPermaLink="false">http://www.thefreakparade.com/2008/07/31/so-you-want-to-learn-nhibernate-part-1-of-1-the-links/</guid>
		<description><![CDATA[NHibernate is a rich and robust open source Object Relational Mapping (ORM) tool. See my preambles to this post for a brief overview of NHibernate and some architectural prerequisites. NHibernate is currently in version 2.0, which is being billed as a complete (or mostly complete) port of Hibernate version 3.2. That means that in addition [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://hsidev.files.wordpress.com/2008/08/image1.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="133" alt="image" src="http://hsidev.files.wordpress.com/2008/08/image-thumb1.png" width="240" align="right" border="0" /></a> NHibernate is a rich and robust open source Object Relational Mapping (ORM) tool. See my preambles to this post for a <a href="http://www.thefreakparade.com/2008/07/31/so-you-want-to-learn-nhibernate-part-0-overview/">brief overview of NHibernate</a> and <a href="http://www.thefreakparade.com/2008/07/31/so-you-want-to-learn-nhibernate-part-12-prerequisites-or-nhibernate-marijuananet/">some architectural prerequisites</a>.</p>
<p>NHibernate is currently in version 2.0, which is being billed as a complete (or mostly complete) port of Hibernate version 3.2. That means that in addition to these resources, books and materials relating to Hibernate 3.2 should also apply in large part to NHibernate 2.0.</p>
<h3><strong>The Official Documentation &amp; Project Resources</strong></h3>
<p><a href="http://nhforge.org/">NHForge</a>     <br />Strange name, but promising new NHibernate community website. It is a little lightly populated at the very moment, but this looks like it will be a one stop shop for downloading NHibernate core libraries and the many satellite projects, documentation, etc.</p>
<p><a href="http://knol.google.com/k/fabio-maulo/-/1nr4enxv3dpeq/21#view">NHibernate Wiki</a>     <br />This is a new resource that was made available along with the release version of NHibernate. I believe the formal NHibernate 2.0 docs live there now.</p>
<p><a href="http://nhibernate.deepgrok.com/">NHibernate Deep Grok</a>    <br />This funkily-named resource is an app-engine / google-custom-search powered search engine focused entirely on NHibernate. If you need to do an Internet search for NHibernate related material, this is a very good place to start.</p>
<p><a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/">NHibernate 1.2 Documentation</a>     <br />A complete reference for NHibernate 1.2, the precursor to 2.0 and the latest official release.</p>
<p><a href="http://groups.google.com/group/nhusers">NHibernate Users Forum &amp; E-Mail Discussion List</a>     <br />A Google group / mailing list for asking and responding to NHibernate questions. Invaluable resource. If you haven&#8217;t participated in an e-mail list (which is like an e-mail based discussion forum) you should try it, you learn a lot and it is fun.</p>
<p><a href="http://sourceforge.net/projects/nhibernate/">Source Code On SourceForge</a>     <br />This is the SourceForge home page where you can download the latest releases or, if you have the constitution for it, check out the latest version from the trunk.</p>
<p><a href="http://www.hibernate.org/343.html">The Project Home Page</a>     <br />The official home of the project at hibernate.org.</p>
<p><a href="http://sourceforge.net/projects/nhcontrib">NH Contrib Project Project Page</a>     <br />The contrib project has some nice components that aren&#8217;t part of the core, but are hugely useful anyway. These include LINQ to NHibernate, a validation framework, a session context framework (Burrow) and other good things.</p>
<h3></h3>
<h3></h3>
<h3><strong>Getting Started</strong></h3>
<p>The REAL starting place is <a href="http://www.thefreakparade.com/2008/07/31/so-you-want-to-learn-nhibernate-part-12-prerequisites-or-nhibernate-marijuananet/">here</a>. But if you&#8217;ve digested those materials and are ready to start writing some code, check out these resources:</p>
<p><a href="http://www.hanselman.com/blog/LearnHowToUseNHibernateWithTheSummerOfNHibernateScreencastSeries.aspx">Learn How to use NHibernate with the Summer of NHibernate Screencast</a>     <br />This is a post by Scott Hanselman pointing to the Summer of NHibernate Screencast series. I linked to this post instead of directly to the screencast page because Scott compiles some other learning materials in the post, and provides commentary.</p>
<p><a href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/01/your-first-nhibernate-based-application.aspx">Your first NHibernate based application</a>     <br /><a href="http://www.svendtofte.com/serverside/setting-up-nhibernate-20/#">Setting up NHibernate 2.0</a>     <br /><a href="http://www.developer.com/open/article.php/10930_3709346_1">Using NHibernate as an ORM Solution for .NET</a></p>
<h3></h3>
<h3><strong>Crucial Community Resources</strong></h3>
<p><a href="http://blogs.hibernatingrhinos.com/nhibernate/Default.aspx">NHibernate FAQ</a>     <br />This is an NHibernate blog, and a fantastic one at that. A good portion of the links on this page are from that blog &#8211; if you are going to develop with NHibernate, you will want to not only subscribe to this blog but take the time to read the archives.</p>
<p><a href="http://www.ayende.com/Blog/category/510.aspx">Ayende&#8217;s NHibernate Category</a>     <br />This is just a link to the RSS feed for the NHibernate category on Ayende Rahien&#8217;s blog (a contributor to NH). Lots of great stuff here.</p>
<p><a href="http://nhplugin.lieser-online.de/">NHibernate Resharper Plugin</a>     <br />If you use Resharper, this plugin will validate your NHibernate xml mappings.</p>
<p>&#160;</p>
<h3><strong>Best Practices &amp; Reference Applications</strong></h3>
<p><a href="http://www.google.com/url?sa=t&amp;ct=res&amp;cd=2&amp;url=http%3A%2F%2Fdevlicio.us%2Fblogs%2Fbilly_mccafferty%2Farchive%2F2007%2F04%2F03%2Fnhibernate-best-practices-with-asp-net-1-2nd-ed.aspx&amp;ei=NkGRSNaqHoKWsAP_183vBQ&amp;usg=AFQjCNGP5mUnezIz8kKJRGg2yoHIi4i2jg&amp;sig2=9SMbEnLpa2hSvUwd1wemsQ"><em>NHibernate Best Practices</em> with ASP.NET, 1.2nd Ed. &#8211; Billy <em>McCafferty</em></a>     <br />This is a code project article about using NHibernate and a reference app using DDD and an ASP.NET MVP pattern.</p>
<p><a href="http://code.google.com/p/sharp-architecture/">S#arp Architecture</a>     <br />This is a CodePlex project providing a reference app and an article included as documentation that provides a reference architecture for using ASP.NET MVC, NHibernate and Castle Windsor. A discussion list for this forum <a href="http://groups.google.com/group/sharp-architecture">is here</a>.</p>
<p><a title="http://codebetter.com/files/folders/codebetter_downloads/entry180972.aspx" href="http://codebetter.com/files/folders/codebetter_downloads/entry180972.aspx">Foundations of Programming Learning Application</a>     <br />This is an application designed to be a reference app for doing DDD. This also uses ASP.NET MVC and NHibernate.</p>
<p><a href="http://weblogs.asp.net/nleghari/archive/2008/07/16/codestore-part-1-of-n-treesurgeon-castle-windsor-log4net.aspx">Code Store Reference App</a>     <br />Another reference app utilizing NHibernate. Also uses Castle Windsor and Tree Surgeon.</p>
<p><a href="http://www.ayende.com/Blog/archive/2008/07/24/How-to-review-NHibernate-application.aspx">How to review a NHibernate application</a>     <br />Ayende&#8217;s list of best practices when designing a system using NHibernate.</p>
<p>&#160;</p>
<h3><strong>NHibernate 2.0 Announcements &amp; New Features</strong></h3>
<p><a href="http://www.ayende.com/Blog/archive/2008/03/31/NHibernate-2.0-Alpha-is-out.aspx">NHibernate 2.0 Alpha is out!</a>     <br /><a href="http://www.infoq.com/news/2008/04/nhibernate-200-alpha">NHibernate 2.0 Announcement from InfoQ</a></p>
<h3><strong>Rhino Commons</strong></h3>
<p>Rhino Commons is part of <a href="http://sourceforge.net/projects/rhino-tools/">Rhino Tools</a>, and must be downloaded from the trunk of that project. Rhino Commons is several things (&quot;<a href="http://www.ayende.com/Blog/archive/2008/07/18/The-purpose-of-Rhino-Commons.aspx">just a utility library&quot; isn&#8217;t one of them</a>) which you can discover for yourself, but one of the things it is is a dash of infrastructure that really smoothes out the wrinkles when working with NHibernate. I can&#8217;t tell you how many posts are on the web relating to setting up a UnitOfWork object and managing sessions, or implementing a generic Repository to abstract working with NHibernate sessions. Rhino Commons provides very usable implementations of these concepts. Rhino Tools, by the way, contains a few sample/reference apps for using Rhino Commons as well as NHibernate. Check out Hibernating Forums, for example. Most of these links are about using Rhino Commons with an ASP.NET MVC app. Not sure why that is, but it works for me.</p>
<p><a href="http://michaelhanney.com/blog/2008/04/28/beginning-systemwebmvc-with-rhino-tools-castle-active-record-and-nhibernate/">Beginning System.Web.MVC with Rhino Tools, Castle Active Record and Nhibernate</a>, <a href="http://michaelhanney.com/blog/2008/05/27/systemwebmvc-rhino-commons-caslte-active-record-nhibernate-part-2/">Pt 2</a>, <a href="http://michaelhanney.com/blog/2008/06/10/systemwebmvc-rhino-commons-castle-active-record-nhibernate-part-3/">Pt3</a>     <br /><a href="http://frickinsweet.com/ryanlanciaux.com/post/RhinoCommons2c-NHibernate-and-ASPNET-MVC.aspx">RhinoCommons, NHibernate and ASP.NET MVC Part 1</a>, <a href="http://frickinsweet.com/ryanlanciaux.com/post/RhinoCommons2c-NHibernate-and-ASPNET-MVC-Part-2--.aspx">Pt2</a>, <a href="http://frickinsweet.com/ryanlanciaux.com/post/RhinoCommons2c-NHibernate-and-ASPNET-MVC-Part-3-the-model.aspx">Pt3</a>, <a href="http://frickinsweet.com/ryanlanciaux.com/post/RhinoCommons2c-NHibernate-and-ASPNET-MVC-Part-4---The-MVC-Application.aspx">Pt4</a>, <a href="http://frickinsweet.com/ryanlanciaux.com/post/RhinoCommons2c-NHibernate-and-ASPNET-MVC-Part-5---LINQ-to-NHibernate.aspx">Pt5</a>     <br /><a href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/10/nhibernate-and-the-unit-of-work-pattern.aspx">NHibernate and the Unit of Work Pattern</a> &lt;&#8211;Not strictly about Rhino Commons, but explains the concepts behind it     <br /><a href="http://www.ayende.com/Blog/archive/2008/03/27/Adaptive-Domain-Models-with-Rhino-Commons.aspx">Adaptive Domain Models with Rhino Commons      <br /></a><a href="http://www.ayende.com/Blog/archive/2007/03/11/AOP-With-Windsor-Adding-Caching-to-IRepositoryT-based-on-Ts.aspx">AOP With Windsor: Adding Caching to IRepository based on T&#8217;s attributes</a>&#160;</p>
<p>Note: In the NHibernate Contrib project is a tool called <a href="http://nhcontrib.wiki.sourceforge.net/BurrowIntroduction">NHibernate Burrow</a> &#8211; it feels to me like the intention of this project and the intention of the session management in Rhino Commons may be the same &#8211; but I haven&#8217;t dug any further than that. Anyone wish to clarify in the comments?</p>
<h3><strong>Misc. Concepts</strong></h3>
<p>&#160;</p>
<h3><strong>Implementing Frictionless Soft Deletes in NHibernate</strong></h3>
<p><a href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/08/soft-deletes.aspx">Soft Delete in NH</a> </p>
<h3><strong>Mapping &amp; Collections</strong></h3>
<p><a href="http://codebetter.com/blogs/jeremy.miller/archive/2008/06/18/working-faster-and-fewer-mapping-errors-with-nhibernate.aspx">Testing Mappings &amp; Fluid Interface for Mapping</a>&#160; <br />The above link explores a mechanism to do NHibernate mappings in code instead of XML, giving you all kinds of benefits.</p>
<p><a href="http://hsidev.files.wordpress.com/2008/08/image2.png"><img style="border-top-width: 0px; border-left-width: 0px; border-bottom-width: 0px; border-right-width: 0px" height="55" alt="image" src="http://hsidev.files.wordpress.com/2008/08/image-thumb2.png" width="227" border="0" /></a></p>
<p><strong>[UPDATE]</strong> Apparently a full blown open source project has been established to build a fluent interface for doing NHibernate mappings, which is exciting. The project source code repository <a href="http://code.google.com/p/fluent-nhibernate/">is here</a>, the Google group / users form <a href="http://groups.google.com/group/fluent-nhibernate">is here</a> and a blog post introducing the library and providing a quick start <a href="http://www.iamnotmyself.com/2008/08/07/SkinningTheCatWithFluentNHibernate.aspx">is here</a>.</p>
<p><a href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/06/12/mapping-collections-in-nhibernate-part-1.aspx">Mapping Collections in NHibernate (Part 1)</a>     <br /><a href="http://devlicio.us/blogs/billy_mccafferty/archive/2007/12/03/custom-collections-with-nhibernate-part-i-the-basics.aspx">Custom Collections with NHibernate, Part I: Who Cares?</a>     <br /><a href="http://devlicio.us/blogs/billy_mccafferty/archive/2007/12/06/custom-collections-with-nhibernate-part-ii-ilist-amp-lt-basic-amp-gt.aspx">Custom Collections with NHibernate, Part II: The Basics</a>     <br /><a href="http://devlicio.us/blogs/billy_mccafferty/archive/2007/12/07/custom-collections-with-nhibernate-part-iii-refactored.aspx">Custom Collections with NHibernate, Part III: Refactored</a></p>
<h3>Generating / Synchronizing the Database Schema from a NHibernate Model</h3>
<h4><strong></strong>    <br /><a href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/28/create-and-update-database-schema.aspx#feedback"></a></h4>
<p><a href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/28/create-and-update-database-schema.aspx#feedback">Create and Update Database Schema</a></p>
<p><strong>Querying &amp; LINQ to NHibernate</strong>     <br /><a href="http://mhinze.com/linq-to-nhibernate-in-10-minutes/">Linq to NHibernate in 10 Minutes      <br /></a><a href="http://www.hookedonlinq.com/LINQToNHibernate.ashx">Linq to NHibernate</a>     <br /><a href="http://codebetter.com/blogs/kyle.baley/archive/2008/04/07/trying-out-linq-for-nhibernate.aspx">Kyle Baley &#8211; Trying out Linq to NHibernate</a>     <br /><a href="http://devlicio.us/blogs/rob_eisenberg/archive/2008/04/03/my-nhibernate-2-0-supa-layer.aspx">My NHibernate 2.0 Supa&#8217; Layer (something new from Rob Eisenberg)</a></p>
<p><a href="http://cromwellhaus.com/blogs/ryanc/archive/2007/11/19/nhibernate-query-generator-with-visual-studio-2008.aspx">NHibernate Query Generator</a>     <br />[Update (see comments)] NHibernate Query Generator will create strongly typed queries when working with NHibernate using .NET 2.0. LINQ to NHibernate supercedes the NHibernate Query Generator, so if you are working in .NET 3.5, prefer to use LINQ for your strongly typed queries. For .NET 2.0 apps, however, NHibernate Query Generator is a strong alternative.</p>
<h3><strong>Lazy Loading &amp; Eager Loading</strong></h3>
<p><a href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/03/lazy-loading---eager-loading.aspx">Lazy Loading &#8211; Eager Loading</a>     <br /><a href="http://blogs.hibernatingrhinos.com/nhibernate/archive/2008/04/06/eager-loading-aggregate-with-many-child-collections.aspx">Eager loading aggregate with many child collections</a></p>
<h3><strong>Entity Joins &amp; Relationships</strong></h3>
<p><a href="http://devlicio.us/blogs/billy_mccafferty/archive/2008/07/11/when-to-use-many-to-one-s-vs-many-to-many-with-nhibernate.aspx">When to use many-to-one(s) vs. many-to-many with NHibernate</a>     <br /><a href="http://devlicio.us/blogs/billy_mccafferty/archive/2008/06/16/performing-join-queries-with-nhibernate-createalias.aspx">Performing Join Queries with NHibernate CreateAlias</a></p>
<h3><strong>Misc</strong></h3>
<p><a href="http://mhinze.com/audit-options-with-nhibernate/">Audit Options with NH</a>     <br /><a href="http://elegantcode.com/2008/07/14/integrating-castle-windsor-and-nhibernate-with-wcf-throwing-the-wcf-facility-and-some-rhino-tools-in-the-mix/">Integrating Castle Windsor and NHibernate with WCF &#8211; Throwing the WCF facility and some Rhino Tools in the mix</a>     <br /><a href="http://elegantcode.com/2008/06/14/book-review-nhibernate-in-action/">Book review: NHibernate in Action</a>     <br /><a href="http://devlicio.us/blogs/mike_nichols/archive/2008/07/29/when-flushing-goes-bad-assigned-ids-in-nhibernate.aspx">Using Entity-Assigned ID&#8217;s</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-1-of-1-the-links/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>So you want to learn NHibernate &#8211; Part 0.5, Prerequisites (or NHibernate = Marijuana.NET)</title>
		<link>http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-12-prerequisites-or-nhibernate-marijuananet/</link>
		<comments>http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-12-prerequisites-or-nhibernate-marijuananet/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 17:53:00 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://www.thefreakparade.com/2008/07/31/so-you-want-to-learn-nhibernate-part-12-prerequisites-or-nhibernate-marijuananet/</guid>
		<description><![CDATA[NHibernate is an Object Relational Mapper (ORM) tool &#8211; which is to say it takes your living, squirming objects from a running application and stuffs them into some kind of database. It also will be happy dig into the database, grab some sleeping object, shake it awake and toss it back into your running application [...]]]></description>
			<content:encoded><![CDATA[<p>NHibernate is an <a href="http://www.agiledata.org/essays/mappingObjects.html">Object Relational Mapper</a> (ORM) tool &#8211; which is to say it takes your living, squirming objects from a running application and stuffs them into some kind of database. It also will be happy dig into the database, grab some sleeping object, shake it awake and toss it back into your running application when you need it.</p>
<p>As a standalone tool, this can be very useful. It saves you writing a metric ton of SQL, it saves you from having to type out a bunch of tedious boilerplate ADO.NET code to execute that SQL and then find something useful to do with the awkward, pointy data sets and data tables and data readers that are returned.</p>
<p>You can get a lot of mileage from just learning how to use NHibernate, replacing your existing data access code, and leaving it at that. Taking that approach, though, would be leaving a great deal of what NHibernate has to offer on the table. ORM&#8217;s such as NHibernate, very much like Inversion of Control containers, are components of a particular kind of loosely coupled, domain centric application design that is all the rage these days (though for very good reasons) called <a href="http://books.google.com/books?id=7dlaMs0SECsC&amp;dq=Domain+Driven+Design&amp;pg=PP1&amp;ots=ulzV0ZXdt2&amp;sig=hzaKeQXyeV70LKuTkwL-Qd3PNzA&amp;hl=en&amp;sa=X&amp;oi=book_result&amp;resnum=1&amp;ct=result#PPP1,M1">Domain Driven Design</a> (DDD).</p>
<p>For the uninitiated, wholesome, mamma&#8217;s boy Microsoft developer picking up a tool like NHibernate or an Inversion of Control Container like <a href="http://www.castleproject.org/container/index.html">Castle Windsor</a>&#160; can often be the first step towards experimenting with <a href="http://www.mikeduncan.com/domain-driven-design-explained/">Domain Driven Design</a> (championed by the <a href="http://altdotnet.org/">ALT.NET community</a>), introducing you to a different kind of crowd that does things in a different kind of way, much like smoking Marijuana is considered the &quot;<a href="http://en.wikipedia.org/wiki/Gateway_drug_theory">gateway drug</a>&quot; to other, &quot;harder&quot; drugs. In the same way that smoking a <a href="http://www.fotosearch.com/photos-images/marijuana-cigarette.html">Marijuana cigarette</a> while listening to your favorite Jazz records with some new friends on Saturday will often lead you to <a href="http://www.youtube.com/watch?v=OgphJlmo0xc">snorting lines of cocaine</a> off of the floor of a public bathroom in a <a href="http://www.tijuanamexicoinsider.com/tijuana-adult-entertainment.asp">Tijuana brothel</a> on Sunday, learning and using tools like NHibernate will often lead you towards learning <a href="http://jeffreypalermo.com/blog/the-onion-architecture-part-1/">a more maintainable, more flexible and generally more fun</a> way of building your software systems.</p>
<p>In concert with <a href="http://martinfowler.com/articles/injection.html">Inversion of Control</a> containers, NHibernate supports the concept of &quot;<a href="http://weblogs.asp.net/pgielens/archive/2005/07/29/420995.aspx">Persistence Ignorance</a>&quot; (PI) &#8211; which more or less means that your domain objects have no idea where, how or even that they are being persisted. This dramatically reduces the coupling of your business logic to its infrastructure, which dramatically increases its maintainability, reusability and ultimately its life span. I&#8217;m no expert in this field, so I&#8217;ll leave it to the experts to do the teaching, but I do feel pretty strongly that before (or in parallel with) learning NHibernate, or any other ORM, it is important to also learn about the kind of architecture it was designed to serve. The resources below should be a very good start:</p>
<p>1. <a href="http://codebetter.com/blogs/karlseguin/archive/2008/06/24/foundations-of-programming-ebook.aspx">Foundations of Programming &#8211; a free e-book by Karl Seguine</a>    <br />This should really be called &quot;An introduction to the ALT.NET approach to Domain Driven Design and Test Driven Development&quot; &#8211; it is far more of an introduction to a particular style of building software(despite the &quot;how memory works&quot; chapter) that it is to the foundations of programming in general, but nevertheless it is a very easy to read, very humbly written and very useful introduction to writing modern enterprise software using .NET. If you&#8217;re already a grizzled ALT.NET warrior, well you aren&#8217;t reading this post, and you probably won&#8217;t get much out of this book, but for those of us that don&#8217;t fit into that category, I highly suggest reading this short, concise introductory text.</p>
<p>2. <a href="http://www.infoq.com/minibooks/domain-driven-design-quickly">Domain Driven Design Quickly</a>    <br />This is a summary of Eric Evan&#8217;s seminal book on Domain Driven Design (which you should also read) in the form of a free e-book. This book will get you out of the starting gate. This is much longer than the Foundations of Programming e-book, so you may want to print it out on the old laser jet and take it home.</p>
<p>3. Onion Architecture <a href="http://jeffreypalermo.com/blog/the-onion-architecture-part-1/">Part 1</a>, <a href="http://jeffreypalermo.com/blog/the-onion-architecture-part-2/">Part 2</a> and <a href="http://jeffreypalermo.com/blog/the-onion-architecture-part-3/">Part3</a>    <br />The name, perhaps, <a href="http://davybrion.com/blog/2008/07/onion-architecture/">is rather silly</a>, but <a href="http://jeffreypalermo.com/">Jeffrey Palermo</a> does a very nice job of describing how an ideal DDD architecture should be constructed, and how application layers should communicate with one another in contrast to more traditional n-tier architecture.</p>
<p>4. <a href="http://ayende.com/Blog/archive/2008/07/25/Default-Architecture-Layers.aspx">Default Architecture: Layers</a>    <br />A less accessible but still useful post describing how <a href="http://ayende.com/Blog/Default.aspx">Ayende Rahien</a> (author of <a href="http://weblogs.asp.net/stephenwalther/archive/2008/03/22/tdd-introduction-to-rhino-mocks.aspx">Rhino Mocks</a>) approaches his application architecture.</p>
<p>5. <a href="http://www.codeproject.com/aspnet/NHibernateBestPractices.asp">NHibernate Best Practices with ASP.NET, 1.2<sup>nd</sup> Ed.</a>    <br />Despite the title, in this article <a href="http://devlicio.us/blogs/billy_mccafferty/default.aspx">Billy McCafferty</a> talks quite a bit about application architecture especially as it relates to ORM, Persistence Ignorance and NHibernate, and is definitely worth reading. He has an updated reference architecture which he calls S#arp Architecture, and it is <a href="http://code.google.com/p/sharp-architecture/">available on Google Code</a>, along with some documentation that contains a hidden gem of morbidly dark humor that is beautifully out of place with the style of the article. I&#8217;ll let you find it yourself, but <a href="http://www.codeplex.com/SharpArchitecture/Release/ProjectReleases.aspx?ReleaseId=15182">the guide</a> is a good read.</p>
<p>6. <a href="http://en.wikipedia.org/wiki/Object-Relational_impedance_mismatch">Object Relational Impedance Mismatch</a>    <br />This is a useful concept to understand before diving into using an ORM for the first time as well, as it is the Object Relational Impedance Mismatch that NHibernate or any other ORM exists to solve. (For a mild debate/discussion of this see <a href="http://codebetter.com/blogs/gregyoung/archive/2008/07/24/impedance-mismatch-reframing.aspx">this post</a> and <a href="http://ayende.com/Blog/archive/2008/07/25/Impedance-Mismatch-and-System-Evolution.aspx">this one</a>). In a nutshell, the &quot;impedance&quot; mismatch is the vast conceptual and structural difference between an object oriented domain model and a table-oriented, set-based relational database. Cramming OO objects into a relational database and the difficulties doing so are the OR Impedance mismatch. FYI, the term &quot;Impedance Mismatch&quot; comes from the EE world, where &quot;<a href="http://en.wikipedia.org/wiki/Electrical_impedance">impedance</a>&quot; is the resistance of a system to the flow of energy. If energy is to flow consistently from one system to an    <br />other when two systems are connected together, then their &quot;impedance&quot; must be <a href="http://en.wikipedia.org/wiki/Impedance_mismatch">matched</a> or <a href="http://en.wikipedia.org/wiki/Impedance_bridging">bridged</a>. I suppose in the case of a software system the &quot;energy&quot; is the representation of the state of the domain, and for that representation to flow consistently in between the boundary between an object graph and a relational data store, both with very different levels of resistance to the state representation (the object model having the far smaller impedance)&#160; a mechanism is required to bridge or match the impedance of the two systems, and in the case of NHibernate that mechanism is the ORM toolset.</p>
<p>In the <a href="http://www.thefreakparade.com/2008/07/31/so-you-want-to-learn-nhibernate-part-1-of-1-the-links/">next post</a> I&#8217;ll provide specific links to NHibernate resources that I&#8217;ve found to help actually learn the tool.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-12-prerequisites-or-nhibernate-marijuananet/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>So you want to learn NHibernate &#8211; Part 0, Overview</title>
		<link>http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-0-overview/</link>
		<comments>http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-0-overview/#comments</comments>
		<pubDate>Thu, 31 Jul 2008 16:38:04 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[DDD]]></category>
		<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[ORM]]></category>

		<guid isPermaLink="false">http://www.thefreakparade.com/2008/07/31/so-you-want-to-learn-nhibernate-part-0-overview/</guid>
		<description><![CDATA[Why?For the past several years we have been using a home grown ORM tool as part of a larger application framework. It works pretty well, but there are a few drawbacks: It&#8217;s home grown &#8211; unless we divert attention from building our business applications, it stays frozen in time. This is a drawback of every [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Why?</strong><br />For the past several years we have been using a home grown <a href="http://en.wikipedia.org/wiki/Object-relational_mapping">ORM</a> tool as part of a larger application framework. It works pretty well, but there are a few drawbacks:</p>
<ul>
<li>It&#8217;s home grown &#8211; unless we divert attention from building our business applications, it stays frozen in time. This is a drawback of every home grown tool, and why a community or third party library should always be considered when good ones are available.
<li>It&#8217;s tied to SQL Server. Getting it to run on another database platform would be quite a bit of work.
<li>No LINQ support, in fact, no query language of any kind. When we want custom queries, we put them in our model editor and generate new code. This get&#8217;s us a method on our DAL to execute the query, but that means there is this whole open-model-editor, make change, generate code, compile code and test cycle for every little query we may need.
<li>As an internal tool, it is rather poorly documented. Training new developers requires using in-house staff. No pointing to a list of links on the web and saying, &#8220;here, go learn this and we&#8217;ll get started&#8221;
<li>It means nothing when you put it on a resume <img src='http://www.thefreakparade.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  </li>
</ul>
<p>As we are embarking on a new set of projects, the time seems right to consider the possibility of moving to a mainstream ORM tool with a healthy community and plenty of learning material. I won&#8217;t go through the selection process, but we looked at some commercial tools and we looked at <a href="http://en.wikipedia.org/wiki/NHibernate">NHibernate</a>, and while the commercial tools have some nice polish on them and comprehensive documentation, the community surrounding NHibernate is so vibrant (and so distinguished) that we&#8217;re strongly leaning in that direction.</p>
<p>NHibernate <em>does </em>lack some polish. It&#8217;s an engine that requires some build-out of infrastructure to make it comfortable to use, but much of that build out has been contributed by community members and where it hasn&#8217;t, the blogosphere has filled the gaps with any number of helpful walk-through&#8217;s and best practices posts. I&#8217;ll post links to the resources I&#8217;ve identified in a subsequent post.</p>
<p><strong>Active Record<br /></strong>Perhaps the most prominent of these community contributed build-outs is the oh-so-famous <a href="http://www.castleproject.org/ActiveRecord/">ActiveRecord</a> implementation that is part of the <a href="http://www.castleproject.org/">Castle Project</a>. NHibernate, in its raw, unprocessed form, handles persisting <a href="http://en.wikipedia.org/wiki/Plain_Old_CLR_Object">Plain Old CLR Objects</a> (<a href="http://www.google.com/musicl?lid=iFDC_QjRN4P&amp;aid=FYqTSuoVu9P">POCO</a>&#8216;s) to a persistence medium by way of <a href="http://www.google.com/codesearch?hl=en&amp;q=.hbm.xml+show:udcA6XCKGI0:1OSSUgtIrVc:udcA6XCKGI0&amp;sa=N&amp;cd=2&amp;ct=rc&amp;cs_p=http://layewong.googlecode.com/svn&amp;cs_f=WebRoot/WEB-INF/classes/cn/edu/pku/ss/operation/GP4RE.hbm.xml">XML mapping files</a> which must be hand crafted. The mapping file contains which fields of a persistent object will be stored to the database, and can control every detail of the mapping between a field and a corresponding database column. The mappings also communicate to NHibernate how entities relate to one another, such as many-to-one, many-to-many, etc. </p>
<p>All this is very powerful, but perhaps not so much fun to manage (although many people prefer to do so manually). <a href="http://davidhayden.com/blog/dave/archive/2006/06/12/2986.aspx">Active Record is a design pattern</a> for object relational mapping that maintains one Class for each Table in a data store, more or less, and Castle Windsor provides an implementation of this pattern such that a combination of <a href="http://en.wikipedia.org/wiki/Convention_over_Configuration">Convention over Configuration</a> and .NET Attributes remove the need for creating and maintaining NHibernate mapping files. In fact, when you use Castle&#8217;s ActiveRecord, you may not know you&#8217;re using NHibernate at all as the whole experience is nicely abstracted. To make this happen it is understood when you use Active Record your objects will be saved to the database in a certain way, and you are OK with that, because it saves you many small decisions and many XML code edits.</p>
<p>Whether or not to use ActiveRecord is, I think, largely a matter of taste and your personal relationship with Convenience(Cost) vs Control, the yin and yang of the Build vs Buy decision. We haven&#8217;t settled on ActiveRecord yet, although we are pretty sure that if we <em>don&#8217;t</em> use ActiveRecord, we&#8217;ll be rolling our own code generator to maintain both NHibernate Mapping Files and the Database Schema, and possibly the Entity classes themselves, based on a metadata model. Maintaining a few trillion XML mapping files doesn&#8217;t sound like a lot of fun to me.</p>
<p><a href="http://www.thefreakparade.com/2008/07/31/so-you-want-to-learn-nhibernate-part-12-prerequisites-or-nhibernate-marijuananet/">Next I&#8217;ll talk a little about architecture</a>, and then drown you in <a href="http://www.thefreakparade.com/2008/07/31/so-you-want-to-learn-nhibernate-part-1-of-1-the-links/">NHibernate hyperlinks</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.thefreakparade.com/2008/07/so-you-want-to-learn-nhibernate-part-0-overview/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NHibernate Reference PDF</title>
		<link>http://www.thefreakparade.com/2008/04/nhibernate-reference-pdf/</link>
		<comments>http://www.thefreakparade.com/2008/04/nhibernate-reference-pdf/#comments</comments>
		<pubDate>Tue, 01 Apr 2008 21:03:38 +0000</pubDate>
		<dc:creator>Nathan</dc:creator>
				<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://www.thefreakparade.com/?p=11</guid>
		<description><![CDATA[NHibernate Reference PDF]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/pdf/nhibernate_reference.pdf">NHibernate Reference PDF</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.thefreakparade.com/2008/04/nhibernate-reference-pdf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
