<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://nhforge.org/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>How to</title><link>http://nhforge.org/wikis/howtonh/default.aspx</link><description>Quick starts, tutorials, code snippets, custom user types, application blocks and more...</description><dc:language>en-US</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31106.3070)</generator><item><title>How to use Db2hbm</title><link>http://nhforge.org/wikis/howtonh/how-to-use-db2hbm/revision/0.aspx</link><pubDate>Thu, 25 Feb 2010 13:05:08 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:72</guid><dc:creator>felicepollano</dc:creator><description>Current revision posted to How to by felicepollano on 25/02/2010 10:05:08 a.m.&lt;br /&gt;
&lt;p align="justify"&gt;Db2hbm is a reverse engineering tool able to generate hbm files from a database schema and some information contained in a configuration file. Unlike other commercial and open source tools serving the same purpose, db2hbm is not template based. The hbm output comes from a serialization based on the NHibernate mapping schema classes. Extendibility is provided through&amp;nbsp; strategies the user can implement or extend. db2hbm does not generate code. In order to generate the classes or other artifacts please consider the use of &lt;a href="/blogs/nhibernate/archive/2009/12/12/t4-hbm2net-alpha-2.aspx"&gt;hbm2net&lt;/a&gt;. &lt;/p&gt;
&lt;p align="justify"&gt;Db2hbm is a command line tool. &lt;a target="_blank" href="/media/p/615.aspx"&gt;You can download it here&lt;/a&gt;. Information on how to connect to the database and various generation options are contained in a separate configuration file you have to provide in order to make the tool work. A schema for the configuration file is provided in the distributed zip:&lt;b&gt;nhibernate-codegen.xsd.&lt;/b&gt; You will have intellisense editing the configuration file in Visual Studio by copying that file under the&lt;b&gt; %Program Files%\Microsoft Visual Studio 9.0\Xml\Schemas&lt;/b&gt; folder. Below there is a configuration file skeleton and a description for each section is provided.&lt;/p&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;span style="font-family:consolas;background:yellow;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:yellow;"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;xml&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;version&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;encoding&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:yellow;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:yellow;"&gt;?&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;db2hbm-conf&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;xmlns&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;urn:nhibernate-codegen-2.2&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;nbsp;&lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;/span&gt;&lt;/b&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;metadata-strategies&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;strategy&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;class&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;NHibernate.Tool.Db2hbm.FirstPassEntityCollector, NHibernate.Tool.Db2hbm&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;strategy&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;class&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;NHibernate.Tool.Db2hbm.PrimaryKeyStrategy, NHibernate.Tool.Db2hbm&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;strategy&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;class&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;NHibernate.Tool.Db2hbm.ManyToOneStrategy, NHibernate.Tool.Db2hbm&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;strategy&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;class&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;NHibernate.Tool.Db2hbm.SetStrategy, NHibernate.Tool.Db2hbm&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;strategy&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;class&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;NHibernate.Tool.Db2hbm.ManyToManyStrategy, NHibernate.Tool.Db2hbm&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;strategy&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;class&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;NHibernate.Tool.Db2hbm.ApplyEntityExceptionsStrategy, NHibernate.Tool.Db2hbm&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:green;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;!--strategy class=&amp;quot;NHibernate.Tool.Db2hbm.SetToMapStrategy, NHibernate.Tool.Db2hbm&amp;quot;/--&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/metadata-strategies&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;foreign-key-crawlers&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;factory&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;NHibernate.Tool.Db2hbm.ForeignKeyCrawlers.MSSQLForeignKeyCrawlerFactory, NHibernate.Tool.Db2hbm&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/factory&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/foreign-key-crawlers&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;type-mapping&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;xml&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;String&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:green;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;!--user type instead--&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;bit&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Boolean&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;varbinary&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Array&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;varchar&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;String&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;nvarchar&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;String&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;nchar&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;String&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;char&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;String&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;numeric&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Decimal&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;decimal&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Decimal&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;tinyint&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Byte&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;smallint&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Int16&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;int&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Int32&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;bigint&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Int64&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;datetime&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;DateTime&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;uniqueidentifier&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Guid&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;money&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Decimal&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;sql-type&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;dbtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;smallmoney&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;nhtype&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Decimal&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/type-mapping&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;naming-strategy&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;class&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;NHibernate.Tool.Db2hbm.DefaultNamingStrategy, NHibernate.Tool.Db2hbm&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;property&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;name&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;Language&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;English&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/property&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/naming-strategy&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;connection-info&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;dialect&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;NHibernate.Dialect.MsSql2005Dialect, NHibernate&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/dialect&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;connection-string&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;Server=localhost\SQLEXPRESS;initial catalog=AdventureWorks;Integrated Security=True&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/connection-string&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;connection-driver&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;NHibernate.Driver.SqlClientDriver, NHibernate&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/connection-driver&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/connection-info&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;table-filter&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;include&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:green;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;!--Include all--&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt;&amp;lt;/table-filter&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt;&amp;lt;tables&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt;&amp;lt;/tables&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt;&amp;lt;entity-exceptions&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:fr-be;" lang="FR-BE"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;entity&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;match&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;.*Addres.*|UnitMeasure|CreditCard&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;member-tag&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;match&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;set|bag|idbag|list&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;exclude&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;true&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;alter&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;set&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;name&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;lazy&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;value&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;false&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt;&amp;lt;meta-add&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt;attribute&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt;&amp;quot;comment&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt;this is a sample meta&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt;&amp;lt;/meta-add&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;mso-ansi-language:it;" lang="IT"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/alter&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/entity&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;entity&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;match&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;.*&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;member-tag&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;match&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;set|bag|idbag|list&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;alter&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;set&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;name&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;access&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;value&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;field.camelcase-underscore&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;meta-add&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;attribute&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;test&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;Value of test&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/meta-add&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/alter&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/member-tag&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;member-tag&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;match&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;many-to-one&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;alter&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;set&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;name&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;fetch&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:red;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;value&lt;/span&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;=&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:#8000ff;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;quot;join&amp;quot;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;/&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/alter&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/member-tag&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/entity&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/entity-exceptions&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;entities-namespace&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;AdventureWorks.Entities&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/entities-namespace&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p style="line-height:normal;margin-bottom:0pt;mso-layout-grid-align:none;" class="MsoNormal"&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&lt;span style="mso-spacerun:yes;"&gt;&amp;nbsp; &lt;/span&gt;&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;entities-assembly&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;AdventureWorks.Entities&lt;/span&gt;&lt;/b&gt;&lt;span style="font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/entities-assembly&amp;gt;&lt;/span&gt;&lt;b&gt;&lt;span style="font-family:consolas;background:white;color:black;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt; &lt;/span&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height:115%;font-family:consolas;background:white;color:blue;font-size:8pt;mso-bidi-font-family:consolas;mso-highlight:white;"&gt;&amp;lt;/db2hbm-conf&amp;gt;&lt;/span&gt;&lt;span style="line-height:115%;font-size:8pt;"&gt; &lt;/span&gt;&lt;/p&gt;
&lt;p class="MsoNormal"&gt;&lt;span style="line-height:115%;font-size:8pt;"&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;&amp;lt;metadata-strategies&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;This section configure the strategy used to infer the mapping from the schema or from what is inferred from the previous strategies. The execution order is preserved and reflect the order on the configuration file. The current version has the following strategy embedded:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;b&gt;FirstPassEntityCollector&lt;/b&gt; &amp;ndash; Collect each table in the schema and provide an entity for each table with a property for each column. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;PrimaryKeyStrategy&lt;/b&gt; &amp;ndash; Find the primary keys on the tables and modify the previously collected entities to reflect the proper &amp;lt;id&amp;gt; or &amp;lt;composite-id&amp;gt; declared in the schema. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;ManyToOneStrategy&lt;/b&gt; &amp;ndash; Find the defined foreign keys, and if they point to mapped tables, creates the &amp;lt;many-to-one&amp;gt; associations &lt;/li&gt;
&lt;li&gt;&lt;b&gt;SetStrategy&lt;/b&gt; &amp;ndash; Make collections at the other end points of a &amp;lt;many-to-one&amp;gt; association. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;ManyToManyStrategy&lt;/b&gt; &amp;ndash; Try to infer if there is a link table between two entities. If so the associative entity is dropped and a pair of collection of type &amp;lt;bag&amp;gt; or &amp;lt;idbag&amp;gt; is created to represent the many-to-many association. &lt;/li&gt;
&lt;li&gt;&lt;b&gt;ApplyEntityExceptionsStrategy&lt;/b&gt; &amp;ndash; Applies code generation exceptions to the entities according to the &lt;b&gt;&lt;i&gt;&amp;lt;entity-exceptions&amp;gt;&lt;/i&gt;&lt;/b&gt; configuration section( see below ) &lt;/li&gt;
&lt;/ul&gt;
&lt;p align="justify"&gt;Each strategy element, if required, can contain one of more element &amp;lt;property&amp;gt; in the followinf form:&lt;/p&gt;
&lt;p align="justify"&gt;&amp;lt;property name=&amp;quot;X&amp;quot;&amp;gt;yyyyyyy&amp;lt;/property&amp;gt;&lt;/p&gt;
&lt;p align="justify"&gt;This means: set the value of the property named &amp;ldquo;X&amp;rdquo; to the value yyyyyy. Internally the value is converted to the target type of the property if it is not a string.&lt;/p&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;&amp;lt;foreign-key-crawlers&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;The core strategies used in reverse engineering requires to know how the foreign key are declared on the tables. Since the ADO.NET schema provider model does not fit this requirement, we have to provide a custom strategy for each DB dialect we are using. &lt;b&gt;&lt;span style="text-decoration:underline;"&gt;Currently only MSSQL server is supported&lt;/span&gt;&lt;/b&gt;, so if you want a proper code generation for another database you should provide your own foreign-key.-crawler, or alternatively configure each FK definition by hand, as shown in the &lt;b&gt;&amp;lt;tables&amp;gt;&lt;/b&gt; configuration section ( you would probably prefer not to ).&lt;/p&gt;
&lt;p align="justify"&gt;To provide your own key crawler, you have to create a factory for it, implementing the interface &lt;b&gt;IForeignKeyCrawlerFactory&lt;/b&gt;, declared as shown below:&lt;/p&gt;
&lt;p&gt;public interface IForeignKeyCrawlerFactory    &lt;br /&gt;{     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; IForeignKeyCrawler Create();     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; void Register();     &lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The register method is called by the infrastructure, and allow you to bind your factory with one or more NHIbernate Dialect. Let&amp;rsquo;s have an example on how the MSSQLForeignKeyCrawlerFactory implement this function:&lt;/p&gt;
&lt;p&gt;public void Register()    &lt;br /&gt;{     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var instance = new MSSQLForeignKeyCrawlerFactory();     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForeignKeyCrawlersRegistar.Register(instance, typeof(MsSql2000Dialect));     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForeignKeyCrawlersRegistar.Register(instance, typeof(MsSql2005Dialect));     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ForeignKeyCrawlersRegistar.Register(instance, typeof(MsSql2008Dialect));     &lt;br /&gt;}&lt;/p&gt;
&lt;p align="justify"&gt;The&amp;nbsp; code above register an instance of MSSQLForeignKeyCrawlerFactory bound to the MsSql200x dialects.&lt;/p&gt;
&lt;p align="justify"&gt;The other method, Create, are supposed to return the IForeignCrawler instance able to deal with the specific database foreign key schema info. This object must implement the following interface:&lt;/p&gt;
&lt;p&gt;public interface IForeignKeyCrawler {    &lt;br /&gt;IForeignKeyColumnInfo[] GetForeignKeyColumns(DbConnection dbConnection     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , string constraintName     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , string catalog     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; , string schema     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; );     &lt;br /&gt;}&lt;/p&gt;
&lt;p align="justify"&gt;To proper implement this you should be able to return an array of &lt;b&gt;IForeignKeyColumnInfo&lt;/b&gt; from the constraint name, the catalog and the schema containing it.&lt;/p&gt;
&lt;p align="justify"&gt;The I&lt;b&gt;ForeignKeyColumnInfo&lt;/b&gt; interface is defined as follow:&lt;/p&gt;
&lt;p&gt;public interface IForeignKeyColumnInfo    &lt;br /&gt;{     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string PrimaryKeyColumnName { get; }     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string PrimaryKeyTableName { get; }     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string PrimaryKeyTableSchema { get;&amp;nbsp; }     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string PrimaryKeyTableCatalog { get;&amp;nbsp; } &lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string ForeignKeyColumnName { get; }    &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string ForeignKeyTableName { get; }     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string ForeignKeyTableSchema { get;&amp;nbsp; }     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string ForeignKeyTableCatalog { get;&amp;nbsp; }&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p align="justify"&gt;&lt;b&gt;PrimaryKey&lt;/b&gt;/(Table/Catalog/Column)&lt;b&gt;Name&lt;/b&gt; must return the key column information as defined in the table containing the primary key referenced by the constraint.&lt;/p&gt;
&lt;p align="justify"&gt;&lt;b&gt;ForeignKey&lt;/b&gt;/(Table/Catalog/Column)&lt;b&gt;Name&lt;/b&gt; must return the key column information as defined in the table containing the foreign key referenced by the constraint.&lt;/p&gt;
&lt;h2&gt;&amp;nbsp;&lt;/h2&gt;
&lt;h2&gt;&amp;lt;type-mapping&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;Each element in this section maps a database type to an NHIbernate type. You can force a type with respect to column length/precision too. So you can have:&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&amp;lt;sql-type dbtype=&amp;quot;varchar&amp;quot; length=&amp;quot;1&amp;quot; nhtype=&amp;quot;Char&amp;quot;/&amp;gt;      &lt;br /&gt;&amp;lt;sql-type dbtype=&amp;quot;varchar&amp;quot; length=&amp;quot;2-*&amp;quot; nhtype=&amp;quot;String&amp;quot;/&amp;gt;&lt;/b&gt;&lt;/p&gt;
&lt;p align="justify"&gt;in order to distinguish between char and strings. The most restrictive satisfied condition is used.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&amp;lt;naming-strategy&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;The naming strategy is a component driving the name generation for the entities, properties, collections and component key class generated by the tool. A default naming strategy is provided: &lt;b&gt;NHibernate.Tool.Db2hbm.DefaultNamingStrategy&lt;/b&gt;. This strategy leverages the unNHAddins inflector to singularize the name of the tables, or pluralize the collections. The unNHaddins inflector is provided for many languages, the DefaultNamingStrategy infer the concrete class to use from the property language:&lt;/p&gt;
&lt;p&gt;&amp;lt;property name=&amp;quot;Language&amp;quot;&amp;gt;English&amp;lt;/property&amp;gt;&lt;/p&gt;
&lt;p align="justify"&gt;If an unknown language is specified, DefaultNamingStrategy uses &amp;ldquo;English &amp;ldquo; by default. In order to implement your own naming strategy, you have to derive from the default naming strategy, or implement your own from scratch by implementing the &lt;b&gt;INamingStrategy interface&lt;/b&gt;. Please note that despites the name, this interface &lt;span style="text-decoration:underline;"&gt;is not the one contained in NHibernate&lt;/span&gt;.&lt;/p&gt;
&lt;p&gt;The interface is defined as follow:&lt;/p&gt;
&lt;p&gt;public interface INamingStrategy    &lt;br /&gt;{     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string GetEntityNameFromTableName(string tableName);     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string GetPropertyNameFromColumnName(string columnName);     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string GetIdPropertyNameFromColumnName(string columnName);     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string GetClassNameForComponentKey(string entityName);     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string GetNameForComponentKey(string entityName,string componentClass);     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string GetNameForManyToOne(string referredEntity, string[] columnNames);     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string GetNameForCollection(string collectingClass, int progressive);     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; string GetClassNameForCollectionComponent(string collectionTableName);     &lt;br /&gt;}&lt;/p&gt;
&lt;p align="justify"&gt;The meaning of the first three functions should be clear by the name. For the other ones:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;b&gt;GetClassNameForComponentKey&lt;/b&gt; &amp;ndash; The entity has a composite key, and it is reverse engineering with a component, implementor has to return a name for the class representing that component. &lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;b&gt;GetNameForManyToOne&lt;/b&gt; &amp;ndash; The entity has a reference to another entity, you have to return the name you want to assign to the corresponding property. Implementor will receive the referred entity name and the column(s) names defining the reference. &lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;b&gt;GetNameForCollection&lt;/b&gt; &amp;ndash; the entity has a collection of other entity instances. The implementor will receive the name of the collected entity, plus a progressive ( you may have more collection of the same type of entity in a class ). implementor has to return the name to assign to the property representhing the collection. &lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;b&gt;GetClassNameForCollectionComponent&lt;/b&gt; &amp;ndash; There is a map of component. implementor has to return the name of the class representing the component. &lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&amp;lt;connection-info&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;Db2hbm needs to connect to the database to inquire into schema information. In this section user will provide the essential parameters to achieve the connection.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;b&gt;&amp;lt;dialect&amp;gt;&lt;/b&gt; &amp;ndash; the NHibernate dialect class. &lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;b&gt;&amp;lt;connection-string&amp;gt;&lt;/b&gt; &amp;ndash; the DB connection string &lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;b&gt;&amp;lt;connection-driver&amp;gt;&lt;/b&gt; &amp;ndash; the NHibernate connection driver &lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&amp;lt;table-filter&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;User can specify which table to include/exclude from the reverse engineering properties by adding keys to this section.&lt;/p&gt;
&lt;p align="justify"&gt;More than one include/exclude element can be specified. Each element has three attributes: &lt;/p&gt;
&lt;p align="justify"&gt;&amp;lt;include catalog=&amp;quot;.*&amp;quot; schema=&amp;quot;.*&amp;quot; table=&amp;quot;.*&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p align="justify"&gt;&amp;lt;exclude table=&amp;quot;UselessTable&amp;quot;/&amp;gt;&lt;/p&gt;
&lt;p align="justify"&gt;you can specify a regular expression to specify the pattern for the catalog, the schema and the table. Tables matching this pattern will be excluded/included.&lt;/p&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&amp;lt;tables&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;If there is not enougth information in the schema, or if there is not a proper foreign key crawler available for the database in use, it is possible to specify manually the foreign key/primary key layout. These information will merge with the ones already present in the schema, if any.&lt;/p&gt;
&lt;p&gt;Here below an example:&lt;/p&gt;
&lt;p&gt;&amp;lt;tables&amp;gt;    &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;table schema=&amp;quot;dbo&amp;quot; catalog=&amp;quot;db2hbm&amp;quot; name=&amp;quot;Simple&amp;quot;&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;primary-key &amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;generator class=&amp;quot;sequence&amp;quot; &amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;param name=&amp;quot;sequence&amp;quot;&amp;gt;id_seq&amp;lt;/param&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/generator&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/primary-key&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;foreign-key constraint-name=&amp;quot;myconstraint&amp;quot; foreign-catalog=&amp;quot;adatabase&amp;quot; foreign-schema=&amp;quot;dbo&amp;quot; foreign-table=&amp;quot;ReferredTable&amp;quot;&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;column-ref foreign-column=&amp;quot;id&amp;quot; local-column=&amp;quot;referred-id&amp;quot;/&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/foreign-key&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/table&amp;gt;     &lt;br /&gt;&amp;nbsp; &amp;lt;/tables&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&amp;lt;entity-exceptions&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;In this section the user can finely drive the produced hbm artifacts by altering the default tool behavior on a per-name o per-tag based strategy. Let&amp;rsquo;s have an example:&lt;/p&gt;
&lt;p&gt;&amp;lt;entity-exceptions&amp;gt;    &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;entity match=&amp;quot;.*Addres.*|UnitMeasure|CreditCard&amp;quot;&amp;nbsp; &amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;member-tag match=&amp;quot;set|bag|idbag|list&amp;quot; exclude=&amp;quot;true&amp;quot;/&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;alter&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;set name=&amp;quot;lazy&amp;quot; value=&amp;quot;false&amp;quot;/&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;meta-add attribute=&amp;quot;comment&amp;quot;&amp;gt;a comment&amp;hellip;&amp;lt;/meta-add&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/alter&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/entity&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;entity match=&amp;quot;.*&amp;quot;&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;member-tag match=&amp;quot;set|bag|idbag|list&amp;quot;&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;alter&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;set name=&amp;quot;access&amp;quot; value=&amp;quot;field.camelcase-underscore&amp;quot;/&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;meta-add attribute=&amp;quot;test&amp;quot;&amp;gt;Value of test&amp;lt;/meta-add&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/alter&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/member-tag&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;member-tag match=&amp;quot;many-to-one&amp;quot;&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;alter&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;set name=&amp;quot;fetch&amp;quot; value=&amp;quot;join&amp;quot;/&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/alter&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/member-tag&amp;gt;     &lt;br /&gt;&amp;nbsp;&amp;nbsp; &amp;lt;/entity&amp;gt;     &lt;br /&gt;&amp;lt;/entity-exceptions&amp;gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p align="justify"&gt;The tag &lt;b&gt;&amp;lt;entity match=&amp;quot;.*Addres.*|UnitMeasure|CreditCard&amp;quot;&amp;gt;&lt;/b&gt; is a selctor based on the entity name. The selector match attribute is a .NET Regex. All entities satisfied this Regex will be interested in the alter process. &lt;/p&gt;
&lt;p align="justify"&gt;The &lt;b&gt;&amp;lt;member-tag&amp;gt;&lt;/b&gt; is a selector, the match is done against the tag name in the generated hbm. The &lt;b&gt;exclude&lt;/b&gt; attribute means, in this case, to remove all the collections from the entity. If a name based selection is required, &lt;b&gt;&amp;lt;member-name&amp;gt;&lt;/b&gt; has to be used, with the same semantic.&lt;/p&gt;
&lt;p align="justify"&gt;The &lt;b&gt;alter tag&lt;/b&gt; drive the modification, and works both on a per-entity or a per-member base. In an alter tag the user can specify &lt;b&gt;&amp;lt;set name=&amp;rdquo;something&amp;rdquo; value=&amp;rdquo;val&amp;rdquo;/&amp;gt;&lt;/b&gt; to set ( or change ) an attribute on the generated hbm.&amp;nbsp; To remove an attribute the &lt;b&gt;&amp;lt;remove name=&amp;rdquo;toremove&amp;rdquo;/&amp;gt;&lt;/b&gt; is required, and for add an additional meta information on the hbm the &lt;b&gt;&amp;lt;meta-add attribute=&amp;rdquo;metaattribute&amp;rdquo;&amp;gt;the attribute content&amp;lt;/meta-attribute&amp;gt;&lt;/b&gt; has to be used.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&amp;lt;entities-namespace&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;Specify the namespace of the generated entities.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;&amp;lt;entities-assembly&amp;gt;&lt;/h2&gt;
&lt;p align="justify"&gt;Specify the assembly containing the generated entities. ( db2hbm does not compile any code, but this is a parameter in the hbm file).&lt;/p&gt;
&lt;p align="justify"&gt;&amp;nbsp;&lt;/p&gt;
&lt;h2&gt;Using the command line tool&lt;/h2&gt;
&lt;p&gt;Using the command line tool is very easy: just launch&lt;/p&gt;
&lt;p&gt;&lt;b&gt;db2hbm &amp;ndash;config:configfilename &amp;ndash;output:outputdir&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;The output directory is optional. If not specified, hbm artifacts will be generated in the current folder.&lt;/p&gt;</description></item><item><title>Customizing Fluent Nhibernate's AutoPersistenceModel Conventions</title><link>http://nhforge.org/wikis/howtonh/customizing-fluent-nhibernate-s-autopersistencemodel-conventions/revision/0.aspx</link><pubDate>Fri, 25 Dec 2009 17:04:15 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:69</guid><dc:creator>Chris Nicola</dc:creator><description>Current revision posted to How to by Chris Nicola on 25/12/2009 02:04:15 p.m.&lt;br /&gt;
&lt;h2&gt;Customizing Fluent Nhibernate&amp;#39;s AutoPersistenceModel Conventions&lt;/h2&gt;
&lt;div style="font-size: 90%;"&gt;Filed under: &lt;span style="text-decoration: line-through; color: red;"&gt;Mapping&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FluentNH&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;AutoPersistenceModel&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;convention&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;over&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configuration&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.lucisferre.net/image.axd?picture=xmlschool_1.jpg"&gt;&lt;img style="border-bottom:0px;border-left:0px;margin:0px 6px 0px 0px;display:inline;border-top:0px;border-right:0px;" title="xmlschool" src="http://www.lucisferre.net/image.axd?picture=xmlschool_thumb.jpg" alt="xmlschool" align="left" border="0" width="184" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(this was originally blogged about &lt;a href="http://www.lucisferre.net/post.aspx?id=0c0eb379-f939-406b-bfb9-a1130a5be664"&gt;here&lt;/a&gt;) &lt;/p&gt;
&lt;p&gt;One of the things I get a fair bit of use out of is the fluent nHibernate project and the AutoPersistenceModel.&amp;nbsp; If you are not very familiar with fluentNH or AutoPersistenceModel then I would suggest checking out their &lt;a href="http://wiki.fluentnhibernate.org/Main_Page"&gt;wiki&lt;/a&gt;, as what I am about to discuss, while not difficult, is some relatively advanced usage.&lt;/p&gt;
&lt;p&gt;The purpose of AutoPersistenceModel is to automatically generate the nHibernate configuration (the HBM files if you are currently used to XML configuration) directly from your model based on Convention over Configuration, &lt;a href="http://www.jameskovacs.com/blog/NETRocks475JamesKovacsOnConventionoverConfiguration.aspx"&gt;you can hear James Kovacs discuss this concept on .NET Rocks&lt;/a&gt;.&amp;nbsp; With tools like SchemaExport and SchemaUpdate it is even possible to automatically generate and execute DDL scripts against your database to keep the schema in sync with your model.&amp;nbsp; This can be a bit rails like in it&amp;#39;s use, in fact &lt;a href="http://adventuresinagile.blogspot.com/"&gt;Adam Dymitruk&lt;/a&gt; is currently working on a utility to extend the SchemaUpdate to allow the creation of versioned database scripts like rails has (ok Adam it&amp;#39;s official, now you actually &lt;i&gt;have&lt;/i&gt; &lt;i&gt;to &lt;/i&gt;finish it!).&lt;/p&gt;
&lt;p&gt;The default AutoPersistenceModel conventions are kept quite simple, so often you will need to do a bit of customization.&amp;nbsp; One way to do this is through overrides which I showed how to use in &lt;a href="http://www.lucisferre.net/post.aspx?id=1734653d-6df8-4aa8-8aef-c264406ced37"&gt;this post&lt;/a&gt;, were I implemented an override for a self-referencing tree relationship.&amp;nbsp; However, whenever possible, it is preferable to use fluentNH&amp;#39;s conventions to do this.&amp;nbsp; Conventions can be used define custom behavior in very flexible ways.&amp;nbsp; Below I am going to show how this can be done to customize database constraints like &lt;i&gt;unique &lt;/i&gt;and &lt;i&gt;index&lt;/i&gt;. [more]&lt;/p&gt;
&lt;p&gt;S#arp Architecture provides a &lt;a href="http://wiki.sharparchitecture.net/Tutorial2DevDomainModel.ashx"&gt;[DomainSignature] attribute&lt;/a&gt; which you can apply to your entity&amp;#39;s properties.&amp;nbsp;&amp;nbsp; The attribute is used to denote the set of properties that uniquely define the entity and is similar to the concept of a &lt;i&gt;business key&lt;/i&gt; often used in SQL database design.&amp;nbsp; It is important to point out that the &lt;i&gt;DomainSignature should&lt;/i&gt;&amp;nbsp;&lt;i&gt;not be considered a primary key &lt;/i&gt;and that you should &lt;i&gt;always use a surrogate primary key&lt;/i&gt; generated either by the database or nHibernate (hilo and guid.comb are the two I prefer).&lt;/p&gt;
&lt;p&gt;The domain signature can ensures that entities can be compared using the properties decorated with [DomainSignature].&amp;nbsp; This is useful if say one object was loaded from the repository using nHibernate but another was constructed and I want to determine if I should treat them as the same entity.&amp;nbsp; It is also useful to determine if a new entity will violate a uniqueness constraint you want to enforce.&lt;/p&gt;
&lt;p&gt;A good example of a useful DomainSignature would be the slug of a blog post.&amp;nbsp; A post also has an &lt;i&gt;id &lt;/i&gt;for it&amp;#39;s primary key&lt;i&gt;,&lt;/i&gt; in most cases a guid, but the slug also uniquely identifies a post as well and no two posts can have the same slug.&amp;nbsp; The only problem now is that when I generate my DDL I can see that nHibernate has no notion that it should enforce my uniqueness constraint.&lt;/p&gt;
&lt;p&gt;What I want is for nHibernate and hence the database schema should be aware that DomainSignature implies a uniqueness constraint.&amp;nbsp; Fortunately, fluent nHibernate conventions make this is quite easy.&amp;nbsp; Fluent nHibernate defines an &lt;i&gt;AttributePropertyConvention&amp;lt;T&amp;gt;&lt;/i&gt; base class for exactly this purpose and we can extend it like this:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5cfc2d16-0a65-4872-b026-c82df251e9a3" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DomainSignatureConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;AttributePropertyConvention&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt;&amp;gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt; attribute, &lt;span style="color:#2b91af;"&gt;IPropertyInstance&lt;/span&gt; instance) { &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.UniqueKey(instance.EntityType.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;DomainSignature&amp;quot;&lt;/span&gt;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The DomainSignatureConvention tells fluent that all properties that are decorated with [DomainSignature] should form a unique key.&amp;nbsp; Now if I then define my entity like this:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d54e305c-c2cc-4f98-a45c-8a3cb5f7b64a" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Price&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;Entity&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style="color:#2b91af;"&gt;DomainSignature&lt;/span&gt;]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Security&lt;/span&gt; Security { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style="color:#2b91af;"&gt;DomainSignature&lt;/span&gt;]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DateTime&lt;/span&gt; PriceDate { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style="color:#2b91af;"&gt;DomainSignature&lt;/span&gt;]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; CanadianPrice { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;decimal&lt;/span&gt; Bid { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;decimal&lt;/span&gt; Ask { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;decimal&lt;/span&gt; Close { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;then SchemaExport will generate DDL like this:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="border-style:none;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;&lt;span style="color:#0000ff;"&gt;create&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;table&lt;/span&gt; Prices (&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;    Id &lt;span style="color:#0000ff;"&gt;INTEGER&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;not&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;,&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   PriceDate DATETIME,&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   CanadianPrice &lt;span style="color:#0000ff;"&gt;INTEGER&lt;/span&gt;,&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   Bid &lt;span style="color:#0000ff;"&gt;NUMERIC&lt;/span&gt;,&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   Ask &lt;span style="color:#0000ff;"&gt;NUMERIC&lt;/span&gt;,&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   &lt;span style="color:#0000ff;"&gt;Close&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;NUMERIC&lt;/span&gt;,&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   SecurityFk &lt;span style="color:#0000ff;"&gt;INTEGER&lt;/span&gt;,&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   &lt;span style="color:#0000ff;"&gt;primary&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;key&lt;/span&gt; (Id),&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;  &lt;span style="color:#0000ff;"&gt;unique&lt;/span&gt; (PriceDate, CanadianPrice)&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;
&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;)&lt;/pre&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--CRLF--&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Except we have a small problem here.&amp;nbsp; The foreign key for the many-to-one relationship on &lt;i&gt;Security&lt;/i&gt; was not included in the &lt;i&gt;unique&lt;/i&gt; constraint.&amp;nbsp; To be quite honest I am not exactly sure why but I am guessing that the &lt;i&gt;AttributePropertyConvention &lt;/i&gt;does not work with a reference.&amp;nbsp; Instead I will need to add something to my &lt;i&gt;ReferenceConvention&lt;/i&gt; which is provided by default with s#arp architecture.&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2787227c-6879-4cc5-8c9a-f06d171b4095" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ReferenceConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;IReferenceConvention&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(FluentNHibernate.Conventions.Instances.&lt;span style="color:#2b91af;"&gt;IManyToOneInstance&lt;/span&gt; instance) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Column(instance.Property.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;Fk&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;Attribute&lt;/span&gt;.IsDefined(instance.Property, &lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt;)))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.UniqueKey(&lt;span style="color:#a31515;"&gt;&amp;quot;DomainSignature&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;I don&amp;#39;t really like this as I don&amp;#39;t think the attribute should be ignored, but it does at least change the above to &lt;i&gt;unique(PriceDate, CanadianPrice, SecurityFk).&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;There are obviously many other types of constraints we could use, you could create an attribute for defining indexing on certain properties like [Indexable(&amp;quot;IndexName&amp;quot;)] and create a convention like this:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:dc415913-baed-4310-ae51-951f5c4fcec1" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IndexableAttribute&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;Attribute&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;readonly&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; _name;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; IndexableAttribute(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; name) { _name = name; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; GetName() { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; _name; }&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IndexableConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;AttributePropertyConvention&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;IndexableAttribute&lt;/span&gt;&amp;gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(&lt;span style="color:#2b91af;"&gt;IndexableAttribute&lt;/span&gt; attribute, &lt;span style="color:#2b91af;"&gt;IPropertyInstance&lt;/span&gt; instance) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Index(attribute.GetName());&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now I can create indicies by using the [Indexable(&amp;quot;Name&amp;quot;)] attribute.&amp;nbsp; Properties with the same &amp;quot;Name&amp;quot; will be part of the same index constraint and indexed together.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I found it is actually a good idea to always index many-to-one relationships, something I briefly mentioned in a &lt;a href="http://www.lucisferre.net/post.aspx?id=ef779300-206b-4582-a9d0-4275b328c8c9"&gt;previous post&lt;/a&gt;.&amp;nbsp; Now that I am using fluent nhibernate however I can&amp;#39;t set the index property in the HBM files so I will need a convention for that.&amp;nbsp; It also makes sense to set this indexing on all many-to-one relationships so there is a better way to do this that does not involve the use of an attribute, instead we implement IRefrenceConvention.&amp;nbsp; S#arp architecture already includes this convention by default so we can just edit it:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0bc6d7e9-4abf-4c45-b26d-85fa8e16fca0" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ReferenceConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;IReferenceConvention&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(FluentNHibernate.Conventions.Instances.&lt;span style="color:#2b91af;"&gt;IManyToOneInstance&lt;/span&gt; instance) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Column(instance.Property.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;Fk&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;Attribute&lt;/span&gt;.IsDefined(instance.Property, &lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt;)))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.UniqueKey(&lt;span style="color:#a31515;"&gt;&amp;quot;DomainSignature&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;else&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Index(instance.Property.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Notice the if.else, if we have already defined &lt;i&gt;UniqueKey&lt;/i&gt; defining Index would be redundant as unique key&amp;#39;s are already indexed.&amp;nbsp; When defining indexes you will typically see something like like the following DDL output from SchemaExport:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;pre id="codeSnippet" style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;&lt;span style="color:#0000ff;"&gt;create&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;index&lt;/span&gt; SecurityIndex &lt;span style="color:#0000ff;"&gt;on&lt;/span&gt; Prices (SecurityFk)&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;p&gt;It is pretty easy to customize the behavior of the fluent nhibernate AutoPersistenceModel using conventions and I find it can be very useful to have this type of fine grained control over your database schema generation.&lt;/p&gt;</description></item><item><title>Customizing Fluent Nhibernate's AutoPersistenceModel Conventions</title><link>http://nhforge.org/wikis/howtonh/customizing-fluent-nhibernate-s-autopersistencemodel-conventions/revision/2.aspx</link><pubDate>Fri, 25 Dec 2009 00:38:05 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:306</guid><dc:creator>Chris Nicola</dc:creator><description>Revision 2 posted to How to by Chris Nicola on 24/12/2009 09:38:05 p.m.&lt;br /&gt;
&lt;h2&gt;Customizing Fluent Nhibernate&amp;#39;s AutoPersistenceModel Conventions&lt;/h2&gt;
&lt;div style="font-size: 90%;"&gt;Filed under: &lt;span style="background: SpringGreen;"&gt;Mapping&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; FluentNH, AutoPersistenceModel, convention over configuration&lt;/div&gt;

&lt;p&gt;&lt;a href="http://www.lucisferre.net/image.axd?picture=xmlschool_1.jpg"&gt;&lt;img style="border-bottom:0px;border-left:0px;margin:0px 6px 0px 0px;display:inline;border-top:0px;border-right:0px;" title="xmlschool" src="http://www.lucisferre.net/image.axd?picture=xmlschool_thumb.jpg" alt="xmlschool" align="left" border="0" width="184" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(this was originally blogged about &lt;a href="http://www.lucisferre.net/post.aspx?id=0c0eb379-f939-406b-bfb9-a1130a5be664"&gt;here&lt;/a&gt;) &lt;/p&gt;
&lt;p&gt;One of the things I get a fair bit of use out of is the fluent nHibernate project and the AutoPersistenceModel.&amp;nbsp; If you are not very familiar with fluentNH or AutoPersistenceModel then I would suggest checking out their &lt;a href="http://wiki.fluentnhibernate.org/Main_Page"&gt;wiki&lt;/a&gt;, as what I am about to discuss, while not difficult, is some relatively advanced usage.&lt;/p&gt;
&lt;p&gt;The purpose of AutoPersistenceModel is to automatically generate the nHibernate configuration (the HBM files if you are currently used to XML configuration) directly from your model based on Convention over Configuration, &lt;a href="http://www.jameskovacs.com/blog/NETRocks475JamesKovacsOnConventionoverConfiguration.aspx"&gt;you can hear James Kovacs discuss this concept on .NET Rocks&lt;/a&gt;.&amp;nbsp; With tools like SchemaExport and SchemaUpdate it is even possible to automatically generate and execute DDL scripts against your database to keep the schema in sync with your model.&amp;nbsp; This can be a bit rails like in it&amp;#39;s use, in fact &lt;a href="http://adventuresinagile.blogspot.com/"&gt;Adam Dymitruk&lt;/a&gt; is currently working on a utility to extend the SchemaUpdate to allow the creation of versioned database scripts like rails has (ok Adam it&amp;#39;s official, now you actually &lt;i&gt;have&lt;/i&gt; &lt;i&gt;to &lt;/i&gt;finish it!).&lt;/p&gt;
&lt;p&gt;The default AutoPersistenceModel conventions are kept quite simple, so often you will need to do a bit of customization.&amp;nbsp; One way to do this is through overrides which I showed how to use in &lt;a href="http://www.lucisferre.net/post.aspx?id=1734653d-6df8-4aa8-8aef-c264406ced37"&gt;this post&lt;/a&gt;, were I implemented an override for a self-referencing tree relationship.&amp;nbsp; However, whenever possible, it is preferable to use fluentNH&amp;#39;s conventions to do this.&amp;nbsp; Conventions can be used define custom behavior in very flexible ways.&amp;nbsp; Below I am going to show how this can be done to customize database constraints like &lt;i&gt;unique &lt;/i&gt;and &lt;i&gt;index&lt;/i&gt;. [more]&lt;/p&gt;
&lt;p&gt;S#arp Architecture provides a &lt;a href="http://wiki.sharparchitecture.net/Tutorial2DevDomainModel.ashx"&gt;[DomainSignature] attribute&lt;/a&gt; which you can apply to your entity&amp;#39;s properties.&amp;nbsp;&amp;nbsp; The attribute is used to denote the set of properties that uniquely define the entity and is similar to the concept of a &lt;i&gt;business key&lt;/i&gt; often used in SQL database design.&amp;nbsp; It is important to point out that the &lt;i&gt;DomainSignature should&lt;/i&gt;&amp;nbsp;&lt;i&gt;not be considered a primary key &lt;/i&gt;and that you should &lt;i&gt;always use a surrogate primary key&lt;/i&gt; generated either by the database or nHibernate (hilo and guid.comb are the two I prefer).&lt;/p&gt;
&lt;p&gt;The domain signature can ensures that entities can be compared using the properties decorated with [DomainSignature].&amp;nbsp; This is useful if say one object was loaded from the repository using nHibernate but another was constructed and I want to determine if I should treat them as the same entity.&amp;nbsp; It is also useful to determine if a new entity will violate a uniqueness constraint you want to enforce.&lt;/p&gt;
&lt;p&gt;A good example of a useful DomainSignature would be the slug of a blog post.&amp;nbsp; A post also has an &lt;i&gt;id &lt;/i&gt;for it&amp;#39;s primary key&lt;i&gt;,&lt;/i&gt; in most cases a guid, but the slug also uniquely identifies a post as well and no two posts can have the same slug.&amp;nbsp; The only problem now is that when I generate my DDL I can see that nHibernate has no notion that it should enforce my uniqueness constraint.&lt;/p&gt;
&lt;p&gt;What I want is for nHibernate and hence the database schema should be aware that DomainSignature implies a uniqueness constraint.&amp;nbsp; Fortunately, fluent nHibernate conventions make this is quite easy.&amp;nbsp; Fluent nHibernate defines an &lt;i&gt;AttributePropertyConvention&amp;lt;T&amp;gt;&lt;/i&gt; base class for exactly this purpose and we can extend it like this:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5cfc2d16-0a65-4872-b026-c82df251e9a3" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DomainSignatureConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;AttributePropertyConvention&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt;&amp;gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt; attribute, &lt;span style="color:#2b91af;"&gt;IPropertyInstance&lt;/span&gt; instance) { &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.UniqueKey(instance.EntityType.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;DomainSignature&amp;quot;&lt;/span&gt;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The DomainSignatureConvention tells fluent that all properties that are decorated with [DomainSignature] should form a unique key.&amp;nbsp; Now if I then define my entity like this:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d54e305c-c2cc-4f98-a45c-8a3cb5f7b64a" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Price&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;Entity&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style="color:#2b91af;"&gt;DomainSignature&lt;/span&gt;]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Security&lt;/span&gt; Security { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style="color:#2b91af;"&gt;DomainSignature&lt;/span&gt;]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DateTime&lt;/span&gt; PriceDate { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style="color:#2b91af;"&gt;DomainSignature&lt;/span&gt;]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; CanadianPrice { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;decimal&lt;/span&gt; Bid { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;decimal&lt;/span&gt; Ask { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;decimal&lt;/span&gt; Close { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;then SchemaExport will generate DDL like this:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="border-style:none;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;&lt;span style="color:#0000ff;"&gt;create&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;table&lt;/span&gt; Prices (&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;    Id &lt;span style="color:#0000ff;"&gt;INTEGER&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;not&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   PriceDate DATETIME,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   CanadianPrice &lt;span style="color:#0000ff;"&gt;INTEGER&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   Bid &lt;span style="color:#0000ff;"&gt;NUMERIC&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   Ask &lt;span style="color:#0000ff;"&gt;NUMERIC&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   &lt;span style="color:#0000ff;"&gt;Close&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;NUMERIC&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   SecurityFk &lt;span style="color:#0000ff;"&gt;INTEGER&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   &lt;span style="color:#0000ff;"&gt;primary&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;key&lt;/span&gt; (Id),&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;  &lt;span style="color:#0000ff;"&gt;unique&lt;/span&gt; (PriceDate, CanadianPrice)&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;)&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Except we have a small problem here.&amp;nbsp; The foreign key for the many-to-one relationship on &lt;i&gt;Security&lt;/i&gt; was not included in the &lt;i&gt;unique&lt;/i&gt; constraint.&amp;nbsp; To be quite honest I am not exactly sure why but I am guessing that the &lt;i&gt;AttributePropertyConvention &lt;/i&gt;does not work with a reference.&amp;nbsp; Instead I will need to add something to my &lt;i&gt;ReferenceConvention&lt;/i&gt; which is provided by default with s#arp architecture.&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2787227c-6879-4cc5-8c9a-f06d171b4095" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ReferenceConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;IReferenceConvention&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(FluentNHibernate.Conventions.Instances.&lt;span style="color:#2b91af;"&gt;IManyToOneInstance&lt;/span&gt; instance) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Column(instance.Property.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;Fk&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;Attribute&lt;/span&gt;.IsDefined(instance.Property, &lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt;)))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.UniqueKey(&lt;span style="color:#a31515;"&gt;&amp;quot;DomainSignature&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;I don&amp;#39;t really like this as I don&amp;#39;t think the attribute should be ignored, but it does at least change the above to &lt;i&gt;unique(PriceDate, CanadianPrice, SecurityFk).&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;There are obviously many other types of constraints we could use, you could create an attribute for defining indexing on certain properties like [Indexable(&amp;quot;IndexName&amp;quot;)] and create a convention like this:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:dc415913-baed-4310-ae51-951f5c4fcec1" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IndexableAttribute&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;Attribute&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;readonly&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; _name;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; IndexableAttribute(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; name) { _name = name; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; GetName() { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; _name; }&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IndexableConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;AttributePropertyConvention&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;IndexableAttribute&lt;/span&gt;&amp;gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(&lt;span style="color:#2b91af;"&gt;IndexableAttribute&lt;/span&gt; attribute, &lt;span style="color:#2b91af;"&gt;IPropertyInstance&lt;/span&gt; instance) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Index(attribute.GetName());&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now I can create indicies by using the [Indexable(&amp;quot;Name&amp;quot;)] attribute.&amp;nbsp; Properties with the same &amp;quot;Name&amp;quot; will be part of the same index constraint and indexed together.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I found it is actually a good idea to always index many-to-one relationships, something I briefly mentioned in a &lt;a href="http://www.lucisferre.net/post.aspx?id=ef779300-206b-4582-a9d0-4275b328c8c9"&gt;previous post&lt;/a&gt;.&amp;nbsp; Now that I am using fluent nhibernate however I can&amp;#39;t set the index property in the HBM files so I will need a convention for that.&amp;nbsp; It also makes sense to set this indexing on all many-to-one relationships so there is a better way to do this that does not involve the use of an attribute, instead we implement IRefrenceConvention.&amp;nbsp; S#arp architecture already includes this convention by default so we can just edit it:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0bc6d7e9-4abf-4c45-b26d-85fa8e16fca0" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ReferenceConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;IReferenceConvention&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(FluentNHibernate.Conventions.Instances.&lt;span style="color:#2b91af;"&gt;IManyToOneInstance&lt;/span&gt; instance) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Column(instance.Property.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;Fk&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;Attribute&lt;/span&gt;.IsDefined(instance.Property, &lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt;)))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.UniqueKey(&lt;span style="color:#a31515;"&gt;&amp;quot;DomainSignature&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;else&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Index(instance.Property.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Notice the if.else, if we have already defined &lt;i&gt;UniqueKey&lt;/i&gt; defining Index would be redundant as unique key&amp;#39;s are already indexed.&amp;nbsp; When defining indexes you will typically see something like like the following DDL output from SchemaExport:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;pre id="codeSnippet" style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;&lt;span style="color:#0000ff;"&gt;create&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;index&lt;/span&gt; SecurityIndex &lt;span style="color:#0000ff;"&gt;on&lt;/span&gt; Prices (SecurityFk)&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;p&gt;It is pretty easy to customize the behavior of the fluent nhibernate AutoPersistenceModel using conventions and I find it can be very useful to have this type of fine grained control over your database schema generation.&lt;/p&gt;</description></item><item><title>Customizing Fluent Nhibernate's AutoPersistenceModel Conventions</title><link>http://nhforge.org/wikis/howtonh/customizing-fluent-nhibernate-s-autopersistencemodel-conventions/revision/1.aspx</link><pubDate>Fri, 25 Dec 2009 00:35:49 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:305</guid><dc:creator>Chris Nicola</dc:creator><description>Revision 1 posted to How to by Chris Nicola on 24/12/2009 09:35:49 p.m.&lt;br /&gt;
&lt;p&gt;&lt;a href="http://www.lucisferre.net/image.axd?picture=xmlschool_1.jpg"&gt;&lt;img style="border-bottom:0px;border-left:0px;margin:0px 6px 0px 0px;display:inline;border-top:0px;border-right:0px;" title="xmlschool" src="http://www.lucisferre.net/image.axd?picture=xmlschool_thumb.jpg" alt="xmlschool" align="left" border="0" width="184" height="244" /&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;(this was originally blogged about &lt;a href="http://www.lucisferre.net/post.aspx?id=0c0eb379-f939-406b-bfb9-a1130a5be664"&gt;here&lt;/a&gt;) &lt;/p&gt;
&lt;p&gt;One of the things I get a fair bit of use out of is the fluent nHibernate project and the AutoPersistenceModel.&amp;nbsp; If you are not very familiar with fluentNH or AutoPersistenceModel then I would suggest checking out their &lt;a href="http://wiki.fluentnhibernate.org/Main_Page"&gt;wiki&lt;/a&gt;, as what I am about to discuss, while not difficult, is some relatively advanced usage.&lt;/p&gt;
&lt;p&gt;The purpose of AutoPersistenceModel is to automatically generate the nHibernate configuration (the HBM files if you are currently used to XML configuration) directly from your model based on Convention over Configuration, &lt;a href="http://www.jameskovacs.com/blog/NETRocks475JamesKovacsOnConventionoverConfiguration.aspx"&gt;you can hear James Kovacs discuss this concept on .NET Rocks&lt;/a&gt;.&amp;nbsp; With tools like SchemaExport and SchemaUpdate it is even possible to automatically generate and execute DDL scripts against your database to keep the schema in sync with your model.&amp;nbsp; This can be a bit rails like in it&amp;#39;s use, in fact &lt;a href="http://adventuresinagile.blogspot.com/"&gt;Adam Dymitruk&lt;/a&gt; is currently working on a utility to extend the SchemaUpdate to allow the creation of versioned database scripts like rails has (ok Adam it&amp;#39;s official, now you actually &lt;i&gt;have&lt;/i&gt; &lt;i&gt;to &lt;/i&gt;finish it!).&lt;/p&gt;
&lt;p&gt;The default AutoPersistenceModel conventions are kept quite simple, so often you will need to do a bit of customization.&amp;nbsp; One way to do this is through overrides which I showed how to use in &lt;a href="http://www.lucisferre.net/post.aspx?id=1734653d-6df8-4aa8-8aef-c264406ced37"&gt;this post&lt;/a&gt;, were I implemented an override for a self-referencing tree relationship.&amp;nbsp; However, whenever possible, it is preferable to use fluentNH&amp;#39;s conventions to do this.&amp;nbsp; Conventions can be used define custom behavior in very flexible ways.&amp;nbsp; Below I am going to show how this can be done to customize database constraints like &lt;i&gt;unique &lt;/i&gt;and &lt;i&gt;index&lt;/i&gt;. [more]&lt;/p&gt;
&lt;p&gt;S#arp Architecture provides a &lt;a href="http://wiki.sharparchitecture.net/Tutorial2DevDomainModel.ashx"&gt;[DomainSignature] attribute&lt;/a&gt; which you can apply to your entity&amp;#39;s properties.&amp;nbsp;&amp;nbsp; The attribute is used to denote the set of properties that uniquely define the entity and is similar to the concept of a &lt;i&gt;business key&lt;/i&gt; often used in SQL database design.&amp;nbsp; It is important to point out that the &lt;i&gt;DomainSignature should&lt;/i&gt;&amp;nbsp;&lt;i&gt;not be considered a primary key &lt;/i&gt;and that you should &lt;i&gt;always use a surrogate primary key&lt;/i&gt; generated either by the database or nHibernate (hilo and guid.comb are the two I prefer).&lt;/p&gt;
&lt;p&gt;The domain signature can ensures that entities can be compared using the properties decorated with [DomainSignature].&amp;nbsp; This is useful if say one object was loaded from the repository using nHibernate but another was constructed and I want to determine if I should treat them as the same entity.&amp;nbsp; It is also useful to determine if a new entity will violate a uniqueness constraint you want to enforce.&lt;/p&gt;
&lt;p&gt;A good example of a useful DomainSignature would be the slug of a blog post.&amp;nbsp; A post also has an &lt;i&gt;id &lt;/i&gt;for it&amp;#39;s primary key&lt;i&gt;,&lt;/i&gt; in most cases a guid, but the slug also uniquely identifies a post as well and no two posts can have the same slug.&amp;nbsp; The only problem now is that when I generate my DDL I can see that nHibernate has no notion that it should enforce my uniqueness constraint.&lt;/p&gt;
&lt;p&gt;What I want is for nHibernate and hence the database schema should be aware that DomainSignature implies a uniqueness constraint.&amp;nbsp; Fortunately, fluent nHibernate conventions make this is quite easy.&amp;nbsp; Fluent nHibernate defines an &lt;i&gt;AttributePropertyConvention&amp;lt;T&amp;gt;&lt;/i&gt; base class for exactly this purpose and we can extend it like this:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:5cfc2d16-0a65-4872-b026-c82df251e9a3" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DomainSignatureConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;AttributePropertyConvention&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt;&amp;gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt; attribute, &lt;span style="color:#2b91af;"&gt;IPropertyInstance&lt;/span&gt; instance) { &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.UniqueKey(instance.EntityType.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;DomainSignature&amp;quot;&lt;/span&gt;);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;The DomainSignatureConvention tells fluent that all properties that are decorated with [DomainSignature] should form a unique key.&amp;nbsp; Now if I then define my entity like this:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:d54e305c-c2cc-4f98-a45c-8a3cb5f7b64a" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Price&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;Entity&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style="color:#2b91af;"&gt;DomainSignature&lt;/span&gt;]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Security&lt;/span&gt; Security { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style="color:#2b91af;"&gt;DomainSignature&lt;/span&gt;]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;DateTime&lt;/span&gt; PriceDate { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;[&lt;span style="color:#2b91af;"&gt;DomainSignature&lt;/span&gt;]&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;bool&lt;/span&gt; CanadianPrice { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;decimal&lt;/span&gt; Bid { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;decimal&lt;/span&gt; Ask { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;virtual&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;decimal&lt;/span&gt; Close { &lt;span style="color:#0000ff;"&gt;get&lt;/span&gt;; &lt;span style="color:#0000ff;"&gt;set&lt;/span&gt;; }&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;then SchemaExport will generate DDL like this:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;div id="codeSnippet" style="border-style:none;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;&lt;span style="color:#0000ff;"&gt;create&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;table&lt;/span&gt; Prices (&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;    Id &lt;span style="color:#0000ff;"&gt;INTEGER&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;not&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;null&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   PriceDate DATETIME,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   CanadianPrice &lt;span style="color:#0000ff;"&gt;INTEGER&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   Bid &lt;span style="color:#0000ff;"&gt;NUMERIC&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   Ask &lt;span style="color:#0000ff;"&gt;NUMERIC&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   &lt;span style="color:#0000ff;"&gt;Close&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;NUMERIC&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   SecurityFk &lt;span style="color:#0000ff;"&gt;INTEGER&lt;/span&gt;,&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;   &lt;span style="color:#0000ff;"&gt;primary&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;key&lt;/span&gt; (Id),&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;  &lt;span style="color:#0000ff;"&gt;unique&lt;/span&gt; (PriceDate, CanadianPrice)&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:white;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;)&lt;/pre&gt;
&amp;lt;!--CRLF--&amp;gt;&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Except we have a small problem here.&amp;nbsp; The foreign key for the many-to-one relationship on &lt;i&gt;Security&lt;/i&gt; was not included in the &lt;i&gt;unique&lt;/i&gt; constraint.&amp;nbsp; To be quite honest I am not exactly sure why but I am guessing that the &lt;i&gt;AttributePropertyConvention &lt;/i&gt;does not work with a reference.&amp;nbsp; Instead I will need to add something to my &lt;i&gt;ReferenceConvention&lt;/i&gt; which is provided by default with s#arp architecture.&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:2787227c-6879-4cc5-8c9a-f06d171b4095" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ReferenceConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;IReferenceConvention&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(FluentNHibernate.Conventions.Instances.&lt;span style="color:#2b91af;"&gt;IManyToOneInstance&lt;/span&gt; instance) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Column(instance.Property.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;Fk&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;Attribute&lt;/span&gt;.IsDefined(instance.Property, &lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt;)))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.UniqueKey(&lt;span style="color:#a31515;"&gt;&amp;quot;DomainSignature&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;I don&amp;#39;t really like this as I don&amp;#39;t think the attribute should be ignored, but it does at least change the above to &lt;i&gt;unique(PriceDate, CanadianPrice, SecurityFk).&lt;/i&gt;&lt;/p&gt;
&lt;p&gt;There are obviously many other types of constraints we could use, you could create an attribute for defining indexing on certain properties like [Indexable(&amp;quot;IndexName&amp;quot;)] and create a convention like this:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:dc415913-baed-4310-ae51-951f5c4fcec1" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IndexableAttribute&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;Attribute&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;private&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;readonly&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; _name;&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; IndexableAttribute(&lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; name) { _name = name; }&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;string&lt;/span&gt; GetName() { &lt;span style="color:#0000ff;"&gt;return&lt;/span&gt; _name; }&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;IndexableConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;AttributePropertyConvention&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;IndexableAttribute&lt;/span&gt;&amp;gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;protected&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;override&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(&lt;span style="color:#2b91af;"&gt;IndexableAttribute&lt;/span&gt; attribute, &lt;span style="color:#2b91af;"&gt;IPropertyInstance&lt;/span&gt; instance) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Index(attribute.GetName());&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Now I can create indicies by using the [Indexable(&amp;quot;Name&amp;quot;)] attribute.&amp;nbsp; Properties with the same &amp;quot;Name&amp;quot; will be part of the same index constraint and indexed together.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I found it is actually a good idea to always index many-to-one relationships, something I briefly mentioned in a &lt;a href="http://www.lucisferre.net/post.aspx?id=ef779300-206b-4582-a9d0-4275b328c8c9"&gt;previous post&lt;/a&gt;.&amp;nbsp; Now that I am using fluent nhibernate however I can&amp;#39;t set the index property in the HBM files so I will need a convention for that.&amp;nbsp; It also makes sense to set this indexing on all many-to-one relationships so there is a better way to do this that does not involve the use of an attribute, instead we implement IRefrenceConvention.&amp;nbsp; S#arp architecture already includes this convention by default so we can just edit it:&lt;/p&gt;
&lt;div id="scid:9ce6104f-a9aa-4a17-a79f-3a39532ebf7c:0bc6d7e9-4abf-4c45-b26d-85fa8e16fca0" class="wlWriterEditableSmartContent" style="padding-bottom:0px;margin:0px;padding-left:0px;padding-right:0px;display:inline;float:none;padding-top:0px;"&gt;
&lt;div style="border:#000080 1px solid;color:#000;font-family:&amp;#39;Courier New&amp;#39;, Courier, Monospace;font-size:10pt;"&gt;
&lt;div style="background:#fff;max-height:300px;overflow:auto;"&gt;&lt;ol style="background:#ffffff;margin:0;padding:0 0 0 5px;"&gt;
&lt;li&gt;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ReferenceConvention&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;IReferenceConvention&lt;/span&gt; {&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;public&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;void&lt;/span&gt; Apply(FluentNHibernate.Conventions.Instances.&lt;span style="color:#2b91af;"&gt;IManyToOneInstance&lt;/span&gt; instance) {&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Column(instance.Property.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;Fk&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;if&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;Attribute&lt;/span&gt;.IsDefined(instance.Property, &lt;span style="color:#0000ff;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;DomainSignatureAttribute&lt;/span&gt;)))&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.UniqueKey(&lt;span style="color:#a31515;"&gt;&amp;quot;DomainSignature&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;span style="color:#0000ff;"&gt;else&lt;/span&gt; &lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;instance.Index(instance.Property.Name + &lt;span style="color:#a31515;"&gt;&amp;quot;Index&amp;quot;&lt;/span&gt;);&lt;/li&gt;
&lt;li style="background:#f3f3f3;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;li&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;}&lt;/li&gt;
&lt;/ol&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;Notice the if.else, if we have already defined &lt;i&gt;UniqueKey&lt;/i&gt; defining Index would be redundant as unique key&amp;#39;s are already indexed.&amp;nbsp; When defining indexes you will typically see something like like the following DDL output from SchemaExport:&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;
&lt;pre id="codeSnippet" style="border-style:none;margin:0em;padding:0px;overflow:visible;text-align:left;line-height:12pt;background-color:#f4f4f4;width:100%;font-family:&amp;#39;Courier New&amp;#39;,courier,monospace;direction:ltr;color:black;font-size:8pt;"&gt;&lt;span style="color:#0000ff;"&gt;create&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;index&lt;/span&gt; SecurityIndex &lt;span style="color:#0000ff;"&gt;on&lt;/span&gt; Prices (SecurityFk)&lt;/pre&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;p&gt;It is pretty easy to customize the behavior of the fluent nhibernate AutoPersistenceModel using conventions and I find it can be very useful to have this type of fine grained control over your database schema generation.&lt;/p&gt;</description></item><item><title>Creating a custom id generator for nHibernate</title><link>http://nhforge.org/wikis/howtonh/creating-a-custom-id-generator-for-nhibernate/revision/0.aspx</link><pubDate>Fri, 25 Dec 2009 00:31:36 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:65</guid><dc:creator>Chris Nicola</dc:creator><description>Current revision posted to How to by Chris Nicola on 24/12/2009 09:31:36 p.m.&lt;br /&gt;
&lt;h2&gt;Creating a custom id generator for nHibernate&lt;/h2&gt;
&lt;div style="font-size: 90%;"&gt;Filed under: &lt;span style="text-decoration: line-through; color: red;"&gt;Mapping&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Nhibernate&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;IIdentifierGenerator&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;IPersistentIdentifierGenerator&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;TableGenerator&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FluentNH&lt;/span&gt;&lt;/div&gt;

&lt;p&gt;I originally blogged about this &lt;a href="http://www.lucisferre.net/post/2009/07/13/Implementing-a-custom-ID-generator-for-nHibernate.aspx"&gt;here &lt;/a&gt;and &lt;a href="http://www.lucisferre.net/post/2009/08/15/Generate-Custom-DDL-for-your-Custom-Id-Generator-with-nHibernate.aspx"&gt;here &lt;/a&gt;on my &lt;a href="http://coding.lucisferre.org"&gt;&lt;/a&gt;&lt;a href="http://www.lucisferre.net"&gt;blog&lt;/a&gt; but Fabio suggested I add these posts to the Forge, so here I am.&amp;nbsp; I have to say I am a little exited to make my first contribution to the Wiki&amp;nbsp;[H].&amp;nbsp; I will try to add a bit more to them and show some examples that do not use the &lt;code&gt;TableGenerator &lt;/code&gt;class but directly implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;.  Please let me know if there are any mistakes or anything else you want to see.&lt;/p&gt;
&lt;p&gt;Before beginning I recommend that you download the NH source code and take a quick look at the &lt;code&gt;TableGenerator &lt;/code&gt;, &lt;code&gt;IIdentifierGenerator and &lt;/code&gt;&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; classes as you will be working with these classes and interfaces to implement your custom generator.&lt;/p&gt;
&lt;h2&gt;Part 1: Inheriting from TableGenerator class&lt;br /&gt;&lt;/h2&gt;
&lt;p&gt;Currently I am doing some work developing a utility that imports
securities data into a fairly old legacy database. It is still SQL but
the database and software havn&amp;#39;t been updated in about 15 years (maybe
more) and never will be again.&lt;/p&gt;
&lt;p&gt;The original application for this database uses a primitive
hilo-style ID generator mechanism. Tt simply queries an integer value
from a table in the database and increments it, then it adds a fixed
value to it and uses that as the next unique ID. It doesn&amp;#39;t seem very
optimal, but that&amp;#39;s how it works and there&amp;#39;s no changing it.&lt;/p&gt;
&lt;p&gt;It isn&amp;#39;t complex, but it also isn&amp;#39;t one of the identity strategies available in nHibernate and I fully intend to use nHibernate.&lt;/p&gt;
&lt;p&gt;So what to do?  One option would be to set &lt;code&gt;generator=&amp;quot;assigned&amp;quot;&lt;/code&gt; and do it all myself, assigning the ID using &lt;code&gt;ADO.Net &lt;/code&gt;directly
or something similar... but what fun would that be? No, I&amp;#39;ve decided to
take a peak at the nHibernate code and learn to extend it. Read on to
find out how to create a custom class that inherits from &lt;code&gt;IIdentifierGenerator &lt;/code&gt;to implement your own custom ID generator strategy for nHibernate.&lt;/p&gt;
&lt;p&gt;One of the beautiful things about nHibernate the ability to extend
it. You can extend its functionality without ever touching their source
code.&lt;/p&gt;
&lt;p&gt;It was very easy to locate the classes responsible for ID generation in the &lt;code&gt;NHibernate.ID &lt;/code&gt;namespace.  It was also clear immediately that most classes inherited from &lt;code&gt;IIdentifierGenerator&lt;/code&gt;.&amp;nbsp;  I also knew that my strategy was similar to the procedure that hilo implements so I started with &lt;code&gt;TableHiLoGenerator &lt;/code&gt;which inherts from &lt;code&gt;TableGenerator&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;After playing around with this for a while and trying different things, it was clear that &lt;code&gt;TableGenerator&lt;/code&gt;, basically takes a &lt;code&gt;tablename &lt;/code&gt;and &lt;code&gt;columnname &lt;/code&gt;from
the configuration, reads a value, increments it and passes it on as an
ID. Voila! That was almost exactly what I needed to do with little else
to change. I was quickly able to create my own class inheriting from
TableGenerator&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;TableGenerator&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;const&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Int32&lt;/span&gt; SeedValue = 1048576;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;readonly&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ILog&lt;/span&gt; Log = &lt;span style="color:#2b91af;"&gt;LogManager&lt;/span&gt;.GetLogger(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;override&lt;/span&gt; &lt;span style="color:blue;"&gt;object&lt;/span&gt; Generate(&lt;span style="color:#2b91af;"&gt;ISessionImplementor&lt;/span&gt; session, &lt;span style="color:blue;"&gt;object&lt;/span&gt; obj)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;int&lt;/span&gt; counter = &lt;span style="color:#2b91af;"&gt;Convert&lt;/span&gt;.ToInt32(&lt;span style="color:blue;"&gt;base&lt;/span&gt;.Generate(session, obj));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; counter + SeedValue + 1;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Not much to that is there? Now that is a fairly simple case, but
even getting more complex isn&amp;#39;t much harder than that. You can
implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;directly and create
something far more customized. TableGenerator actually implements
&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; which is an interface for identifiers
which need to write and updated value to the database. However, since
nHibernate provides so many versatile and inheritable base class
generators that you will likely get by with inheriting one of those and
extending it as I did.&lt;/p&gt;
&lt;p&gt;In order to use this custom generator class I setup my configuration to use it.  Using Fluent I wrote a mapping like this:&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;InvestSpecMap&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;FDPEntityBaseMap&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;InvestSpec&lt;/span&gt;&amp;gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap()&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(tablename + &lt;span style="color:#a31515;"&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(FDPGenerator.&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//Name of the ID counter table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column for this table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AnnualDividend).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AnnlzdDiv&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AssetClass);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CurrencyType);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CusipNumber).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;CusipNum&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.DividendFreq).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;DivFrequency&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.FullName);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.MaturityDate).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;MaturityDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.PriceAsOf).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;PriceAsOfDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.ShortName).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AbbrName&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TaxTreatment);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TickerSymbol);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.Type);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.UnitPrice);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can do the same with XML mappings just declare the assembly and
class as you usually would in XML. This is actually the first time I&amp;#39;ve
used FluentNH.&lt;/p&gt;
&lt;p&gt;What is great about this is that even when testing my mappings with SQLLite, &lt;code&gt;SchemaExport &lt;/code&gt;is
actually able to create the identity table based on the tablename and
columnname properties in the nHibernate configuration. The main benefit
here however is that identity generation remains transparent to the
rest of my application. Also doing something cool with nHibernate,
that&amp;#39;s priceless of course&lt;/p&gt;
&lt;h2&gt;Part 2: Stealing from TableGenerator and controlling DDL generation&lt;/h2&gt;
&lt;p&gt;A while ago I &lt;a href="http://www.lucisferre.org/coding/index.php/2009/07/13/implementing-a-custom-id-generator-for-nhibernate-1"&gt;posted &lt;/a&gt;
about writing a custom id generator using nHibernate and extending one
of the existing Generator classes nHibernate provides.&amp;nbsp; This was done
to support working with a legacy database which uses a custom id
generation strategy.&amp;nbsp; One thing I like to do with all my apps is write
some basic CRUD tests to make sure my mappings and queries are all
working properly.&lt;/p&gt;
&lt;p&gt;To do this I use Oren&amp;#39;s approach of &lt;a href="http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx"&gt;creating a temporary in-memory database &lt;/a&gt;using SQLite to work with.&amp;nbsp; This involves using the&amp;nbsp; &lt;code&gt;SchemaExport &lt;/code&gt;tool
in nHibernate to generate the DDL to create the database.&amp;nbsp; If you are
using a table generator strategy it also needs to create the table and
columns for the custom id generator.&amp;nbsp; In some cases you may need to
customize the DDL for your Id table.&lt;/p&gt;
&lt;p&gt;As I discovered the &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;DDL&lt;/span&gt; to generate the table &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;store&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;next&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;id&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;value&lt;/span&gt; for &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;my&lt;/span&gt; custom id is
only &lt;span style="text-decoration: line-through; color: red;"&gt;run&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;created&lt;/span&gt; once &lt;span style="text-decoration: line-through; color: red;"&gt;per&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;and &lt;span style="text-decoration: line-through; color: red;"&gt;then&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;only&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;on&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;does&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;not&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;check&lt;/span&gt; the &lt;span style="text-decoration: line-through; color: red;"&gt;base&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;column&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;value&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;each&lt;/span&gt; class&lt;span style="text-decoration: line-through; color: red;"&gt;if&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;are&lt;/span&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;inheriting)&lt;/span&gt;.&amp;nbsp; For my id generator there is a separate column used for
each table in the database&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="text-decoration: line-through; color: red;"&gt;So&lt;/span&gt;, &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;so&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;was&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;problem&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;For&lt;/span&gt; example&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; the &lt;i&gt;Price &lt;/i&gt;table has a column in the &lt;i&gt;Counter &lt;/i&gt;table called &lt;i&gt;Price &lt;/i&gt;to store it&amp;#39;s counter and the &lt;i&gt;Holding &lt;/i&gt;table has a column called &lt;i&gt;Holding&lt;/i&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/i&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;but&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;was&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;getting&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;one&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;column&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;appears&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;a href="http://stackoverflow.com/questions/1944927/schemaexport-vs-hilo-algorithm"&gt;&lt;span style="background: SpringGreen;"&gt;problem&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;hilo&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SchemaExport&lt;/span&gt;&lt;/a&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;currently&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;one&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;column&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;per&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;The TableGenerator class supports two parameters which are set in the HBM files (or using fluent) &lt;i&gt;tablename &lt;/i&gt;and &lt;i&gt;columnname &lt;/i&gt;which
set the table and column names used for the id counter.&amp;nbsp; If you have a
copy of the nHibernate source code you will see that the TableGenerator
class calls&lt;code&gt; SqlCreateStrings()&lt;/code&gt;and &lt;code&gt;SqlDropString()&lt;/code&gt;
to create and drop the table for the id generator.&amp;nbsp; Unfortunately, as I
mentioned above this is only called once, and so it only creates one
table with one column for whichever mapping is handled first.&lt;/p&gt;
&lt;p&gt;In order to fix this I had to copy the &lt;code&gt;TableGenerator &lt;/code&gt;class (yes, yes, I know copy-paste is bad form) and modify those functions.&amp;nbsp; I also added a third parameter &lt;i&gt;allcolumnnames&lt;/i&gt; in which I can provide a comma separated list of all the columns the table needs to have (one per table in my database).&amp;nbsp; The &lt;code&gt;SqlCreateStrings()&lt;/code&gt;is simple changed to:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt;[] SqlCreateStrings(&lt;span style="color:#2b91af;"&gt;Dialect&lt;/span&gt; dialect) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; create = &lt;span style="color:#a31515;"&gt;&amp;quot;create table &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; insert = &lt;span style="color:#a31515;"&gt;&amp;quot;insert into &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; values (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color:blue;"&gt;string&lt;/span&gt; s &lt;span style="color:blue;"&gt;in&lt;/span&gt; allcolumns.Split(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;)) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; create += &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + s + &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + dialect.GetTypeName(columnSqlType) + &lt;span style="color:#a31515;"&gt;&amp;quot;,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; insert += &lt;span style="color:#a31515;"&gt;&amp;quot; 1,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; create = create.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; insert = insert.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;new&lt;/span&gt;[] {create, insert};&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;(Yes, yes, I know I should have learned from my &lt;a href="http://www.lucisferre.org/coding/index.php/2009/08/04/strings-are-immutable-stupid"&gt;last post &lt;/a&gt;and used a &lt;code&gt;StringBuilder &lt;/code&gt;here as I pointed out in my last post, but seriously, this method will only ever be called once)&lt;/p&gt;
&lt;p&gt;Now when it is called it will create the correct table with all the
columns I need. A couple of example mappings for the database in
FluentNH are shown below:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpecID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; PriceMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPriceID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To be completely &amp;quot;clean code&amp;quot; and avoid repeating myself I should probably factor out the &lt;code&gt;Id() &lt;/code&gt;code into a method in an inhereted base class so I can call it from each mapping class like this:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; SetIdGenerator(&lt;span style="color:blue;"&gt;string&lt;/span&gt; tablename) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(TableName + &lt;span style="color:#a31515;"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, AllColumns)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, TableName); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now I can unit test using a temporary in-memory SQLite database and all my tests are passing.&lt;/p&gt;</description></item><item><title>Creating a custom id generator for nHibernate</title><link>http://nhforge.org/wikis/howtonh/creating-a-custom-id-generator-for-nhibernate/revision/4.aspx</link><pubDate>Fri, 25 Dec 2009 00:25:51 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:304</guid><dc:creator>Chris Nicola</dc:creator><description>Revision 4 posted to How to by Chris Nicola on 24/12/2009 09:25:51 p.m.&lt;br /&gt;
&lt;h2&gt;Creating a custom id generator for nHibernate&lt;/h2&gt;
&lt;div style="font-size: 90%;"&gt;Filed under: Mapping, Nhibernate, IIdentifierGenerator, IPersistentIdentifierGenerator, TableGenerator, FluentNH&lt;/div&gt;

&lt;p&gt;I originally blogged about this &lt;a href="http://www.lucisferre.net/post/2009/07/13/Implementing-a-custom-ID-generator-for-nHibernate.aspx"&gt;here &lt;/a&gt;and &lt;a href="http://www.lucisferre.net/post/2009/08/15/Generate-Custom-DDL-for-your-Custom-Id-Generator-with-nHibernate.aspx"&gt;here &lt;/a&gt;on my &lt;a href="http://coding.lucisferre.org"&gt;&lt;/a&gt;&lt;a href="http://www.lucisferre.net"&gt;blog&lt;/a&gt; but Fabio suggested I add these posts to the Forge, so here I am.&amp;nbsp; I have to say I am a little exited to make my first contribution to the Wiki&amp;nbsp;[H].&amp;nbsp; I will try to add a bit more to them and show some examples that do not use the &lt;code&gt;TableGenerator &lt;/code&gt;class but directly implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;.  Please let me know if there are any mistakes or anything else you want to see.&lt;/p&gt;
&lt;p&gt;Before beginning I recommend that you download the NH source code and take a quick look at the &lt;code&gt;TableGenerator &lt;/code&gt;, &lt;code&gt;IIdentifierGenerator and &lt;/code&gt;&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; classes as you will be working with these classes and interfaces to implement your custom generator.&lt;/p&gt;
&lt;h2&gt;Part 1: Inheriting from TableGenerator class&lt;br /&gt;&lt;/h2&gt;
&lt;p&gt;Currently I am doing some work developing a utility that imports
securities data into a fairly old legacy database. It is still SQL but
the database and software havn&amp;#39;t been updated in about 15 years (maybe
more) and never will be again.&lt;/p&gt;
&lt;p&gt;The original application for this database uses a primitive
hilo-style ID generator mechanism. Tt simply queries an integer value
from a table in the database and increments it, then it adds a fixed
value to it and uses that as the next unique ID. It doesn&amp;#39;t seem very
optimal, but that&amp;#39;s how it works and there&amp;#39;s no changing it.&lt;/p&gt;
&lt;p&gt;It isn&amp;#39;t complex, but it also isn&amp;#39;t one of the identity strategies available in nHibernate and I fully intend to use nHibernate.&lt;/p&gt;
&lt;p&gt;So what to do?  One option would be to set &lt;code&gt;generator=&amp;quot;assigned&amp;quot;&lt;/code&gt; and do it all myself, assigning the ID using &lt;code&gt;ADO.Net &lt;/code&gt;directly
or something similar... but what fun would that be? No, I&amp;#39;ve decided to
take a peak at the nHibernate code and learn to extend it. Read on to
find out how to create a custom class that inherits from &lt;code&gt;IIdentifierGenerator &lt;/code&gt;to implement your own custom ID generator strategy for nHibernate.&lt;/p&gt;
&lt;p&gt;One of the beautiful things about nHibernate the ability to extend
it. You can extend its functionality without ever touching their source
code.&lt;/p&gt;
&lt;p&gt;It was very easy to locate the classes responsible for ID generation in the &lt;code&gt;NHibernate.ID &lt;/code&gt;namespace.  It was also clear immediately that most classes inherited from &lt;code&gt;IIdentifierGenerator&lt;/code&gt;.&amp;nbsp;  I also knew that my strategy was similar to the procedure that hilo implements so I started with &lt;code&gt;TableHiLoGenerator &lt;/code&gt;which inherts from &lt;code&gt;TableGenerator&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;After playing around with this for a while and trying different things, it was clear that &lt;code&gt;TableGenerator&lt;/code&gt;, basically takes a &lt;code&gt;tablename &lt;/code&gt;and &lt;code&gt;columnname &lt;/code&gt;from
the configuration, reads a value, increments it and passes it on as an
ID. Voila! That was almost exactly what I needed to do with little else
to change. I was quickly able to create my own class inheriting from
TableGenerator&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;TableGenerator&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;const&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Int32&lt;/span&gt; SeedValue = 1048576;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;readonly&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ILog&lt;/span&gt; Log = &lt;span style="color:#2b91af;"&gt;LogManager&lt;/span&gt;.GetLogger(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;override&lt;/span&gt; &lt;span style="color:blue;"&gt;object&lt;/span&gt; Generate(&lt;span style="color:#2b91af;"&gt;ISessionImplementor&lt;/span&gt; session, &lt;span style="color:blue;"&gt;object&lt;/span&gt; obj)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;int&lt;/span&gt; counter = &lt;span style="color:#2b91af;"&gt;Convert&lt;/span&gt;.ToInt32(&lt;span style="color:blue;"&gt;base&lt;/span&gt;.Generate(session, obj));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; counter + SeedValue + 1;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Not much to that is there? Now that is a fairly simple case, but
even getting more complex isn&amp;#39;t much harder than that. You can
implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;directly and create
something far more customized. TableGenerator actually implements
&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; which is an interface for identifiers
which need to write and updated value to the database. However, since
nHibernate provides so many versatile and inheritable base class
generators that you will likely get by with inheriting one of those and
extending it as I did.&lt;/p&gt;
&lt;p&gt;In order to use this custom generator class I setup my configuration to use it.  Using Fluent I wrote a mapping like this:&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;InvestSpecMap&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;FDPEntityBaseMap&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;InvestSpec&lt;/span&gt;&amp;gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap()&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(tablename + &lt;span style="color:#a31515;"&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(FDPGenerator.&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//Name of the ID counter table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column for this table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AnnualDividend).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AnnlzdDiv&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AssetClass);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CurrencyType);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CusipNumber).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;CusipNum&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.DividendFreq).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;DivFrequency&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.FullName);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.MaturityDate).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;MaturityDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.PriceAsOf).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;PriceAsOfDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.ShortName).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AbbrName&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TaxTreatment);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TickerSymbol);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.Type);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.UnitPrice);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can do the same with XML mappings just declare the assembly and
class as you usually would in XML. This is actually the first time I&amp;#39;ve
used FluentNH.&lt;/p&gt;
&lt;p&gt;What is great about this is that even when testing my mappings with SQLLite, &lt;code&gt;SchemaExport &lt;/code&gt;is
actually able to create the identity table based on the tablename and
columnname properties in the nHibernate configuration. The main benefit
here however is that identity generation remains transparent to the
rest of my application. Also doing something cool with nHibernate,
that&amp;#39;s priceless of course&lt;/p&gt;
&lt;h2&gt;Part 2: Stealing from TableGenerator and controlling DDL generation&lt;/h2&gt;
&lt;p&gt;A while ago I &lt;a href="http://www.lucisferre.org/coding/index.php/2009/07/13/implementing-a-custom-id-generator-for-nhibernate-1"&gt;posted &lt;/a&gt;
about writing a custom id generator using nHibernate and extending one
of the existing Generator classes nHibernate provides.&amp;nbsp; This was done
to support working with a legacy database which uses a custom id
generation strategy.&amp;nbsp; One thing I like to do with all my apps is write
some basic CRUD tests to make sure my mappings and queries are all
working properly.&lt;/p&gt;
&lt;p&gt;To do this I use Oren&amp;#39;s approach of &lt;a href="http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx"&gt;creating a temporary in-memory database &lt;/a&gt;using SQLite to work with.&amp;nbsp; This involves using the&amp;nbsp; &lt;code&gt;SchemaExport &lt;/code&gt;tool
in nHibernate to generate the DDL to create the database.&amp;nbsp; If you are
using a table generator strategy it also needs to create the table and
columns for the custom id generator.&amp;nbsp; In some cases you may need to
customize the DDL for your Id table.&lt;/p&gt;
&lt;p&gt;As I discovered the code to generate the table for a custom id is
only run once per class (and then only on the base class if you are
inheriting).&amp;nbsp; For my id generator there is a separate column used for
each table in the database.&amp;nbsp; So, for example the &lt;i&gt;Price &lt;/i&gt;table has a column in the &lt;i&gt;Counter &lt;/i&gt;table called &lt;i&gt;Price &lt;/i&gt;to store it&amp;#39;s counter and the &lt;i&gt;Holding &lt;/i&gt;table has a column called &lt;i&gt;Holding&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;The TableGenerator class supports two parameters which are set in the HBM files (or using fluent) &lt;i&gt;tablename &lt;/i&gt;and &lt;i&gt;columnname &lt;/i&gt;which
set the table and column names used for the id counter.&amp;nbsp; If you have a
copy of the nHibernate source code you will see that the TableGenerator
class calls&lt;code&gt; SqlCreateStrings()&lt;/code&gt;and &lt;code&gt;SqlDropString()&lt;/code&gt;
to create and drop the table for the id generator.&amp;nbsp; Unfortunately, as I
mentioned above this is only called once, and so it only creates one
table with one column for whichever mapping is handled first.&lt;/p&gt;
&lt;p&gt;In order to fix this I had to copy the &lt;code&gt;TableGenerator &lt;/code&gt;class (yes, yes, I know copy-paste is bad form) and modify those functions.&amp;nbsp; I also added a third parameter &lt;i&gt;allcolumnnames&lt;/i&gt; in which I can provide a comma separated list of all the columns the table needs to have (one per table in my database).&amp;nbsp; The &lt;code&gt;SqlCreateStrings()&lt;/code&gt;is simple changed to:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt;[] SqlCreateStrings(&lt;span style="color:#2b91af;"&gt;Dialect&lt;/span&gt; dialect) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; create = &lt;span style="color:#a31515;"&gt;&amp;quot;create table &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; insert = &lt;span style="color:#a31515;"&gt;&amp;quot;insert into &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; values (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color:blue;"&gt;string&lt;/span&gt; s &lt;span style="color:blue;"&gt;in&lt;/span&gt; allcolumns.Split(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;)) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; create += &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + s + &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + dialect.GetTypeName(columnSqlType) + &lt;span style="color:#a31515;"&gt;&amp;quot;,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; insert += &lt;span style="color:#a31515;"&gt;&amp;quot; 1,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; create = create.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; insert = insert.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;new&lt;/span&gt;[] {create, insert};&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;(Yes, yes, I know I should have learned from my &lt;a href="http://www.lucisferre.org/coding/index.php/2009/08/04/strings-are-immutable-stupid"&gt;last post &lt;/a&gt;and used a &lt;code&gt;StringBuilder &lt;/code&gt;here as I pointed out in my last post, but seriously, this method will only ever be called once)&lt;/p&gt;
&lt;p&gt;Now when it is called it will create the correct table with all the
columns I need. A couple of example mappings for the database in
FluentNH are shown below:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpecID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; PriceMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPriceID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To be completely &amp;quot;clean code&amp;quot; and avoid repeating myself I should probably factor out the &lt;code&gt;Id() &lt;/code&gt;code into a method in an inhereted base class so I can call it from each mapping class like this:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; SetIdGenerator(&lt;span style="color:blue;"&gt;string&lt;/span&gt; tablename) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(TableName + &lt;span style="color:#a31515;"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, AllColumns)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, TableName); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now I can unit test using a temporary in-memory SQLite database and all my tests are passing.&lt;/p&gt;</description></item><item><title>Creating a custom id generator for nHibernate</title><link>http://nhforge.org/wikis/howtonh/creating-a-custom-id-generator-for-nhibernate/revision/3.aspx</link><pubDate>Fri, 25 Dec 2009 00:18:06 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:303</guid><dc:creator>Chris Nicola</dc:creator><description>Revision 3 posted to How to by Chris Nicola on 24/12/2009 09:18:06 p.m.&lt;br /&gt;
&lt;h2&gt;Creating a custom id generator for nHibernate&lt;/h2&gt;
&lt;div style="font-size: 90%;"&gt;Filed under: Mapping, Nhibernate, IIdentifierGenerator, IPersistentIdentifierGenerator, TableGenerator, FluentNH&lt;/div&gt;

&lt;p&gt;I originally blogged about this &lt;a href="http://www.lucisferre.net/post/2009/07/13/Implementing-a-custom-ID-generator-for-nHibernate.aspx"&gt;here &lt;/a&gt;and &lt;a href="http://www.lucisferre.net/post/2009/08/15/Generate-Custom-DDL-for-your-Custom-Id-Generator-with-nHibernate.aspx"&gt;here &lt;/a&gt;on my &lt;a href="http://coding.lucisferre.org"&gt;blog&lt;/a&gt; but Fabio suggested I add these posts to the Forge, so here I am.&amp;nbsp; I have to say I am a little exited to make my first contribution to the Wiki&amp;nbsp;[H].&amp;nbsp; I will try to add a bit more to them and show some examples that do not use the &lt;code&gt;TableGenerator &lt;/code&gt;class but directly implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;.  Please let me know if there are any mistakes or anything else you want to see.&lt;/p&gt;
&lt;p&gt;Before beginning I recommend that you download the NH source code and take a quick look at the &lt;code&gt;TableGenerator &lt;/code&gt;, &lt;code&gt;IIdentifierGenerator and &lt;/code&gt;&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; classes as you will be working with these classes and interfaces to implement your custom generator.&lt;/p&gt;
&lt;h2&gt;Part 1: Inheriting from TableGenerator class&lt;br /&gt;&lt;/h2&gt;
&lt;p&gt;Currently I am doing some work developing a utility that imports
securities data into a fairly old legacy database. It is still SQL but
the database and software havn&amp;#39;t been updated in about 15 years (maybe
more) and never will be again.&lt;/p&gt;
&lt;p&gt;The original application for this database uses a primitive
hilo-style ID generator mechanism. Tt simply queries an integer value
from a table in the database and increments it, then it adds a fixed
value to it and uses that as the next unique ID. It doesn&amp;#39;t seem very
optimal, but that&amp;#39;s how it works and there&amp;#39;s no changing it.&lt;/p&gt;
&lt;p&gt;It isn&amp;#39;t complex, but it also isn&amp;#39;t one of the identity strategies available in nHibernate and I fully intend to use nHibernate.&lt;/p&gt;
&lt;p&gt;So what to do?  One option would be to set &lt;code&gt;generator=&amp;quot;assigned&amp;quot;&lt;/code&gt; and do it all myself, assigning the ID using &lt;code&gt;ADO.Net &lt;/code&gt;directly
or something similar... but what fun would that be? No, I&amp;#39;ve decided to
take a peak at the nHibernate code and learn to extend it. Read on to
find out how to create a custom class that inherits from &lt;code&gt;IIdentifierGenerator &lt;/code&gt;to implement your own custom ID generator strategy for nHibernate.&lt;/p&gt;
&lt;p&gt;One of the beautiful things about nHibernate the ability to extend
it. You can extend its functionality without ever touching their source
code.&lt;/p&gt;
&lt;p&gt;It was very easy to locate the classes responsible for ID generation in the &lt;code&gt;NHibernate.ID &lt;/code&gt;namespace.  It was also clear immediately that most classes inherited from &lt;code&gt;IIdentifierGenerator&lt;/code&gt;.&amp;nbsp;  I also knew that my strategy was similar to the procedure that hilo implements so I started with &lt;code&gt;TableHiLoGenerator &lt;/code&gt;which inherts from &lt;code&gt;TableGenerator&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;After playing around with this for a while and trying different things, it was clear that &lt;code&gt;TableGenerator&lt;/code&gt;, basically takes a &lt;code&gt;tablename &lt;/code&gt;and &lt;code&gt;columnname &lt;/code&gt;from
the configuration, reads a value, increments it and passes it on as an
ID. Voila! That was almost exactly what I needed to do with little else
to change. I was quickly able to create my own class inheriting from
TableGenerator&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;TableGenerator&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;const&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Int32&lt;/span&gt; SeedValue = 1048576;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;readonly&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ILog&lt;/span&gt; Log = &lt;span style="color:#2b91af;"&gt;LogManager&lt;/span&gt;.GetLogger(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;override&lt;/span&gt; &lt;span style="color:blue;"&gt;object&lt;/span&gt; Generate(&lt;span style="color:#2b91af;"&gt;ISessionImplementor&lt;/span&gt; session, &lt;span style="color:blue;"&gt;object&lt;/span&gt; obj)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;int&lt;/span&gt; counter = &lt;span style="color:#2b91af;"&gt;Convert&lt;/span&gt;.ToInt32(&lt;span style="color:blue;"&gt;base&lt;/span&gt;.Generate(session, obj));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; counter + SeedValue + 1;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Not much to that is there? Now that is a fairly simple case, but
even getting more complex isn&amp;#39;t much harder than that. You can
implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;directly and create
something far more customized. TableGenerator actually implements
&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; which is an interface for identifiers
which need to write and updated value to the database. However, since
nHibernate provides so many versatile and inheritable base class
generators that you will likely get by with inheriting one of those and
extending it as I did.&lt;/p&gt;
&lt;p&gt;In order to use this custom generator class I setup my configuration to use it.  Using Fluent I wrote a mapping like this:&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;InvestSpecMap&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;FDPEntityBaseMap&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;InvestSpec&lt;/span&gt;&amp;gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap()&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(tablename + &lt;span style="color:#a31515;"&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(FDPGenerator.&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//Name of the ID counter table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column for this table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AnnualDividend).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AnnlzdDiv&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AssetClass);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CurrencyType);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CusipNumber).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;CusipNum&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.DividendFreq).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;DivFrequency&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.FullName);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.MaturityDate).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;MaturityDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.PriceAsOf).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;PriceAsOfDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.ShortName).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AbbrName&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TaxTreatment);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TickerSymbol);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.Type);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.UnitPrice);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can do the same with XML mappings just declare the assembly and
class as you usually would in XML. This is actually the first time I&amp;#39;ve
used FluentNH.&lt;/p&gt;
&lt;p&gt;What is great about this is that even when testing my mappings with SQLLite, &lt;code&gt;SchemaExport &lt;/code&gt;is
actually able to create the identity table based on the tablename and
columnname properties in the nHibernate configuration. The main benefit
here however is that identity generation remains transparent to the
rest of my application. Also doing something cool with nHibernate,
that&amp;#39;s priceless of course&lt;/p&gt;
&lt;h2&gt;Part 2: Stealing from TableGenerator and controlling DDL generation&lt;/h2&gt;
&lt;p&gt;A while ago I &lt;a href="http://www.lucisferre.org/coding/index.php/2009/07/13/implementing-a-custom-id-generator-for-nhibernate-1"&gt;posted &lt;/a&gt;
about writing a custom id generator using nHibernate and extending one
of the existing Generator classes nHibernate provides.&amp;nbsp; This was done
to support working with a legacy database which uses a custom id
generation strategy.&amp;nbsp; One thing I like to do with all my apps is write
some basic CRUD tests to make sure my mappings and queries are all
working properly.&lt;/p&gt;
&lt;p&gt;To do this I use Oren&amp;#39;s approach of &lt;a href="http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx"&gt;creating a temporary in-memory database &lt;/a&gt;using SQLite to work with.&amp;nbsp; This involves using the&amp;nbsp; &lt;code&gt;SchemaExport &lt;/code&gt;tool
in nHibernate to generate the DDL to create the database.&amp;nbsp; If you are
using a table generator strategy it also needs to create the table and
columns for the custom id generator.&amp;nbsp; In some cases you may need to
customize the DDL for your Id table.&lt;/p&gt;
&lt;p&gt;As I discovered the code to generate the table for a custom id is
only run once per class (and then only on the base class if you are
inheriting).&amp;nbsp; For my id generator there is a separate column used for
each table in the database.&amp;nbsp; So, for example the &lt;i&gt;Price &lt;/i&gt;table has a column in the &lt;i&gt;Counter &lt;/i&gt;table called &lt;i&gt;Price &lt;/i&gt;to store it&amp;#39;s counter and the &lt;i&gt;Holding &lt;/i&gt;table has a column called &lt;i&gt;Holding&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;The TableGenerator class supports two parameters which are set in the HBM files (or using fluent) &lt;i&gt;tablename &lt;/i&gt;and &lt;i&gt;columnname &lt;/i&gt;which
set the table and column names used for the id counter.&amp;nbsp; If you have a
copy of the nHibernate source code you will see that the TableGenerator
class calls&lt;code&gt; SqlCreateStrings()&lt;/code&gt;and &lt;code&gt;SqlDropString()&lt;/code&gt;
to create and drop the table for the id generator.&amp;nbsp; Unfortunately, as I
mentioned above this is only called once, and so it only creates one
table with one column for whichever mapping is handled first.&lt;/p&gt;
&lt;p&gt;In order to fix this I had to copy the &lt;code&gt;TableGenerator &lt;/code&gt;class (yes, yes, I know copy-paste is bad form) and modify those functions.&amp;nbsp; I also added a third parameter &lt;i&gt;allcolumnnames&lt;/i&gt; in which I can provide a comma separated list of all the columns the table needs to have (one per table in my database).&amp;nbsp; The &lt;code&gt;SqlCreateStrings()&lt;/code&gt;is simple changed to:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt;[] SqlCreateStrings(&lt;span style="color:#2b91af;"&gt;Dialect&lt;/span&gt; dialect) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; create = &lt;span style="color:#a31515;"&gt;&amp;quot;create table &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; insert = &lt;span style="color:#a31515;"&gt;&amp;quot;insert into &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; values (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color:blue;"&gt;string&lt;/span&gt; s &lt;span style="color:blue;"&gt;in&lt;/span&gt; allcolumns.Split(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;)) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; create += &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + s + &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + dialect.GetTypeName(columnSqlType) + &lt;span style="color:#a31515;"&gt;&amp;quot;,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; insert += &lt;span style="color:#a31515;"&gt;&amp;quot; 1,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; create = create.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; insert = insert.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;new&lt;/span&gt;[] {create, insert};&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;(Yes, yes, I know I should have learned from my &lt;a href="http://www.lucisferre.org/coding/index.php/2009/08/04/strings-are-immutable-stupid"&gt;last post &lt;/a&gt;and used a &lt;code&gt;StringBuilder &lt;/code&gt;here as I pointed out in my last post, but seriously, this method will only ever be called once)&lt;/p&gt;
&lt;p&gt;Now when it is called it will create the correct table with all the
columns I need. A couple of example mappings for the database in
FluentNH are shown below:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpecID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; PriceMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPriceID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To be completely &amp;quot;clean code&amp;quot; and avoid repeating myself I should probably factor out the &lt;code&gt;Id() &lt;/code&gt;code into a method in an inhereted base class so I can call it from each mapping class like this:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; SetIdGenerator(&lt;span style="color:blue;"&gt;string&lt;/span&gt; tablename) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(TableName + &lt;span style="color:#a31515;"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, AllColumns)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, TableName); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now I can unit test using a temporary in-memory SQLite database and all my tests are passing.&lt;/p&gt;</description></item><item><title>Creating a custom id generator for nHibernate</title><link>http://nhforge.org/wikis/howtonh/creating-a-custom-id-generator-for-nhibernate/revision/2.aspx</link><pubDate>Thu, 03 Sep 2009 16:42:06 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:302</guid><dc:creator>Chris Nicola</dc:creator><description>Revision 2 posted to How to by Chris Nicola on 03/09/2009 01:42:06 p.m.&lt;br /&gt;
&lt;h2&gt;Creating a custom id generator for nHibernate&lt;/h2&gt;
&lt;div style="font-size: 90%;"&gt;Filed under: Mapping, Nhibernate, IIdentifierGenerator, IPersistentIdentifierGenerator, TableGenerator, FluentNH&lt;/div&gt;

&lt;p&gt;I originally blogged about this &lt;a href="http://www.lucisferre.org/coding/index.php/2009/07/13/implementing-a-custom-id-generator-for-nhibernate-1"&gt;here &lt;/a&gt;and &lt;a href="http://www.lucisferre.org/coding/index.php/2009/08/15/generate-custom-ddl-for-your-custom-id-generator-with-nhibernate"&gt;here &lt;/a&gt;on my &lt;a href="http://coding.lucisferre.org"&gt;blog&lt;/a&gt; but Fabio suggested I add these posts to the Forge, so here I am.&amp;nbsp; I have to say I am a little exited to make my first contribution to the Wiki&amp;nbsp;[H].&amp;nbsp; I will try to add a bit more to them and show some examples that do not use the &lt;code&gt;TableGenerator &lt;/code&gt;class but directly implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;.  Please let me know if there are any mistakes or anything else you want to see.&lt;/p&gt;
&lt;p&gt;Before beginning I recommend that you download the NH source code and take a quick look at the &lt;code&gt;TableGenerator &lt;/code&gt;, &lt;code&gt;IIdentifierGenerator and &lt;/code&gt;&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; classes as you will be working with these classes and interfaces to implement your custom generator.&lt;/p&gt;
&lt;h2&gt;Part 1: Inheriting from TableGenerator class&lt;br /&gt;&lt;/h2&gt;
&lt;p&gt;Currently I am doing some work developing a utility that imports
securities data into a fairly old legacy database. It is still SQL but
the database and software havn&amp;#39;t been updated in about 15 years (maybe
more) and never will be again.&lt;/p&gt;
&lt;p&gt;The original application for this database uses a primitive
hilo-style ID generator mechanism. Tt simply queries an integer value
from a table in the database and increments it, then it adds a fixed
value to it and uses that as the next unique ID. It doesn&amp;#39;t seem very
optimal, but that&amp;#39;s how it works and there&amp;#39;s no changing it.&lt;/p&gt;
&lt;p&gt;It isn&amp;#39;t complex, but it also isn&amp;#39;t one of the identity strategies available in nHibernate and I fully intend to use nHibernate.&lt;/p&gt;
&lt;p&gt;So what to do?  One option would be to set &lt;code&gt;generator=&amp;quot;assigned&amp;quot;&lt;/code&gt; and do it all myself, assigning the ID using &lt;code&gt;ADO.Net &lt;/code&gt;directly
or something similar... but what fun would that be? No, I&amp;#39;ve decided to
take a peak at the nHibernate code and learn to extend it. Read on to
find out how to create a custom class that inherits from &lt;code&gt;IIdentifierGenerator &lt;/code&gt;to implement your own custom ID generator strategy for nHibernate.&lt;/p&gt;
&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--{12519950541020}--&amp;gt;&lt;/span&gt;
&lt;/p&gt;
&lt;p&gt;One of the beautiful things about nHibernate the ability to extend
it. You can extend its functionality without ever touching their source
code.&lt;/p&gt;
&lt;p&gt;It was very easy to locate the classes responsible for ID generation in the &lt;code&gt;NHibernate.ID &lt;/code&gt;namespace.  It was also clear immediately that most classes inherited from &lt;code&gt;IIdentifierGenerator&lt;/code&gt;.&amp;nbsp;  I also knew that my strategy was similar to the procedure that hilo implements so I started with &lt;code&gt;TableHiLoGenerator &lt;/code&gt;which inherts from &lt;code&gt;TableGenerator&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;After playing around with this for a while and trying different things, it was clear that &lt;code&gt;TableGenerator&lt;/code&gt;, basically takes a &lt;code&gt;tablename &lt;/code&gt;and &lt;code&gt;columnname &lt;/code&gt;from
the configuration, reads a value, increments it and passes it on as an
ID. Voila! That was almost exactly what I needed to do with little else
to change. I was quickly able to create my own class inheriting from
TableGenerator&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;TableGenerator&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;const&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Int32&lt;/span&gt; SeedValue = 1048576;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;readonly&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ILog&lt;/span&gt; Log = &lt;span style="color:#2b91af;"&gt;LogManager&lt;/span&gt;.GetLogger(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;override&lt;/span&gt; &lt;span style="color:blue;"&gt;object&lt;/span&gt; Generate(&lt;span style="color:#2b91af;"&gt;ISessionImplementor&lt;/span&gt; session, &lt;span style="color:blue;"&gt;object&lt;/span&gt; obj)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;int&lt;/span&gt; counter = &lt;span style="color:#2b91af;"&gt;Convert&lt;/span&gt;.ToInt32(&lt;span style="color:blue;"&gt;base&lt;/span&gt;.Generate(session, obj));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; counter + SeedValue + 1;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Not much to that is there? Now that is a fairly simple case, but
even getting more complex isn&amp;#39;t much harder than that. You can
implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;directly and create
something far more customized. TableGenerator actually implements
&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; which is an interface for identifiers
which need to write and updated value to the database. However, since
nHibernate provides so many versatile and inheritable base class
generators that you will likely get by with inheriting one of those and
extending it as I did.&lt;/p&gt;
&lt;p&gt;In order to use this custom generator class I setup my configuration to use it.  Using Fluent I wrote a mapping like this:&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;InvestSpecMap&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;FDPEntityBaseMap&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;InvestSpec&lt;/span&gt;&amp;gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap()&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(tablename + &lt;span style="color:#a31515;"&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(FDPGenerator.&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//Name of the ID counter table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column for this table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AnnualDividend).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AnnlzdDiv&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AssetClass);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CurrencyType);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CusipNumber).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;CusipNum&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.DividendFreq).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;DivFrequency&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.FullName);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.MaturityDate).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;MaturityDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.PriceAsOf).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;PriceAsOfDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.ShortName).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AbbrName&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TaxTreatment);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TickerSymbol);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.Type);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.UnitPrice);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can do the same with XML mappings just declare the assembly and
class as you usually would in XML. This is actually the first time I&amp;#39;ve
used FluentNH.&lt;/p&gt;
&lt;p&gt;What is great about this is that even when testing my mappings with SQLLite, &lt;code&gt;SchemaExport &lt;/code&gt;is
actually able to create the identity table based on the tablename and
columnname properties in the nHibernate configuration. The main benefit
here however is that identity generation remains transparent to the
rest of my application. Also doing something cool with nHibernate,
that&amp;#39;s priceless of course&lt;/p&gt;
&lt;h2&gt;Part 2: Stealing from TableGenerator and controlling DDL generation&lt;/h2&gt;
&lt;p&gt;A while ago I &lt;a href="http://www.lucisferre.org/coding/index.php/2009/07/13/implementing-a-custom-id-generator-for-nhibernate-1"&gt;posted &lt;/a&gt;
about writing a custom id generator using nHibernate and extending one
of the existing Generator classes nHibernate provides.&amp;nbsp; This was done
to support working with a legacy database which uses a custom id
generation strategy.&amp;nbsp; One thing I like to do with all my apps is write
some basic CRUD tests to make sure my mappings and queries are all
working properly.&lt;/p&gt;
&lt;p&gt;To do this I use Oren&amp;#39;s approach of &lt;a href="http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx"&gt;creating a temporary in-memory database &lt;/a&gt;using SQLite to work with.&amp;nbsp; This involves using the&amp;nbsp; &lt;code&gt;SchemaExport &lt;/code&gt;tool
in nHibernate to generate the DDL to create the database.&amp;nbsp; If you are
using a table generator strategy it also needs to create the table and
columns for the custom id generator.&amp;nbsp; In some cases you may need to
customize the DDL for your Id table.&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--{12519956184740}--&amp;gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;As I discovered the code to generate the table for a custom id is
only run once per class (and then only on the base class if you are
inheriting).&amp;nbsp; For my id generator there is a separate column used for
each table in the database.&amp;nbsp; So, for example the &lt;i&gt;Price &lt;/i&gt;table has a column in the &lt;i&gt;Counter &lt;/i&gt;table called &lt;i&gt;Price &lt;/i&gt;to store it&amp;#39;s counter and the &lt;i&gt;Holding &lt;/i&gt;table has a column called &lt;i&gt;Holding&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;The TableGenerator class supports two parameters which are set in the HBM files (or using fluent) &lt;i&gt;tablename &lt;/i&gt;and &lt;i&gt;columnname &lt;/i&gt;which
set the table and column names used for the id counter.&amp;nbsp; If you have a
copy of the nHibernate source code you will see that the TableGenerator
class calls&lt;code&gt; SqlCreateStrings()&lt;/code&gt;and &lt;code&gt;SqlDropString()&lt;/code&gt;
to create and drop the table for the id generator.&amp;nbsp; Unfortunately, as I
mentioned above this is only called once, and so it only creates one
table with one column for whichever mapping is handled first.&lt;/p&gt;
&lt;p&gt;In order to fix this I had to copy the &lt;code&gt;TableGenerator &lt;/code&gt;class (yes, yes, I know copy-paste is bad form) and modify those functions.&amp;nbsp; I also added a third parameter &lt;i&gt;allcolumnnames&lt;/i&gt; in which I can provide a comma separated list of all the columns the table needs to have (one per table in my database).&amp;nbsp; The &lt;code&gt;SqlCreateStrings()&lt;/code&gt;is simple changed to:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt;[] SqlCreateStrings(&lt;span style="color:#2b91af;"&gt;Dialect&lt;/span&gt; dialect) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; create = &lt;span style="color:#a31515;"&gt;&amp;quot;create table &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; insert = &lt;span style="color:#a31515;"&gt;&amp;quot;insert into &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; values (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color:blue;"&gt;string&lt;/span&gt; s &lt;span style="color:blue;"&gt;in&lt;/span&gt; allcolumns.Split(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;)) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; create += &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + s + &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + dialect.GetTypeName(columnSqlType) + &lt;span style="color:#a31515;"&gt;&amp;quot;,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; insert += &lt;span style="color:#a31515;"&gt;&amp;quot; 1,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; create = create.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; insert = insert.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;new&lt;/span&gt;[] {create, insert};&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;(Yes, yes, I know I should have learned from my &lt;a href="http://www.lucisferre.org/coding/index.php/2009/08/04/strings-are-immutable-stupid"&gt;last post &lt;/a&gt;and used a &lt;code&gt;StringBuilder &lt;/code&gt;here as I pointed out in my last post, but seriously, this method will only ever be called once)&lt;/p&gt;
&lt;p&gt;Now when it is called it will create the correct table with all the
columns I need. A couple of example mappings for the database in
FluentNH are shown below:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpecID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; PriceMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPriceID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To be completely &amp;quot;clean code&amp;quot; and avoid repeating myself I should probably factor out the &lt;code&gt;Id() &lt;/code&gt;code into a method in an inhereted base class so I can call it from each mapping class like this:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; SetIdGenerator(&lt;span style="color:blue;"&gt;string&lt;/span&gt; tablename) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(TableName + &lt;span style="color:#a31515;"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, AllColumns)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, TableName); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now I can unit test using a temporary in-memory SQLite database and all my tests are passing.&lt;/p&gt;</description></item><item><title>Creating a custom id generator for nHibernate</title><link>http://nhforge.org/wikis/howtonh/creating-a-custom-id-generator-for-nhibernate/revision/1.aspx</link><pubDate>Thu, 03 Sep 2009 16:41:21 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:293</guid><dc:creator>Chris Nicola</dc:creator><description>Revision 1 posted to How to by Chris Nicola on 03/09/2009 01:41:21 p.m.&lt;br /&gt;
&lt;p&gt;I originally blogged about this &lt;a href="http://www.lucisferre.org/coding/index.php/2009/07/13/implementing-a-custom-id-generator-for-nhibernate-1"&gt;here &lt;/a&gt;and &lt;a href="http://www.lucisferre.org/coding/index.php/2009/08/15/generate-custom-ddl-for-your-custom-id-generator-with-nhibernate"&gt;here &lt;/a&gt;on my &lt;a href="http://coding.lucisferre.org"&gt;blog&lt;/a&gt; but Fabio suggested I add these posts to the Forge, so here I am.&amp;nbsp; I have to say I am a little exited to make my first contribution to the Wiki&amp;nbsp;[H].&amp;nbsp; I will try to add a bit more to them and show some examples that do not use the &lt;code&gt;TableGenerator &lt;/code&gt;class but directly implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;.  Please let me know if there are any mistakes or anything else you want to see.&lt;/p&gt;
&lt;p&gt;Before beginning I recommend that you download the NH source code and take a quick look at the &lt;code&gt;TableGenerator &lt;/code&gt;, &lt;code&gt;IIdentifierGenerator and &lt;/code&gt;&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; classes as you will be working with these classes and interfaces to implement your custom generator.&lt;/p&gt;
&lt;h2&gt;Part 1: Inheriting from TableGenerator class&lt;br /&gt;&lt;/h2&gt;
&lt;p&gt;Currently I am doing some work developing a utility that imports
securities data into a fairly old legacy database. It is still SQL but
the database and software havn&amp;#39;t been updated in about 15 years (maybe
more) and never will be again.&lt;/p&gt;
&lt;p&gt;The original application for this database uses a primitive
hilo-style ID generator mechanism. Tt simply queries an integer value
from a table in the database and increments it, then it adds a fixed
value to it and uses that as the next unique ID. It doesn&amp;#39;t seem very
optimal, but that&amp;#39;s how it works and there&amp;#39;s no changing it.&lt;/p&gt;
&lt;p&gt;It isn&amp;#39;t complex, but it also isn&amp;#39;t one of the identity strategies available in nHibernate and I fully intend to use nHibernate.&lt;/p&gt;
&lt;p&gt;So what to do?  One option would be to set &lt;code&gt;generator=&amp;quot;assigned&amp;quot;&lt;/code&gt; and do it all myself, assigning the ID using &lt;code&gt;ADO.Net &lt;/code&gt;directly
or something similar... but what fun would that be? No, I&amp;#39;ve decided to
take a peak at the nHibernate code and learn to extend it. Read on to
find out how to create a custom class that inherits from &lt;code&gt;IIdentifierGenerator &lt;/code&gt;to implement your own custom ID generator strategy for nHibernate.&lt;/p&gt;
&amp;lt;!--{12519950541020}--&amp;gt;
&lt;p&gt;One of the beautiful things about nHibernate the ability to extend
it. You can extend its functionality without ever touching their source
code.&lt;/p&gt;
&lt;p&gt;It was very easy to locate the classes responsible for ID generation in the &lt;code&gt;NHibernate.ID &lt;/code&gt;namespace.  It was also clear immediately that most classes inherited from &lt;code&gt;IIdentifierGenerator&lt;/code&gt;.&amp;nbsp;  I also knew that my strategy was similar to the procedure that hilo implements so I started with &lt;code&gt;TableHiLoGenerator &lt;/code&gt;which inherts from &lt;code&gt;TableGenerator&lt;/code&gt;.&lt;/p&gt;
&lt;p&gt;After playing around with this for a while and trying different things, it was clear that &lt;code&gt;TableGenerator&lt;/code&gt;, basically takes a &lt;code&gt;tablename &lt;/code&gt;and &lt;code&gt;columnname &lt;/code&gt;from
the configuration, reads a value, increments it and passes it on as an
ID. Voila! That was almost exactly what I needed to do with little else
to change. I was quickly able to create my own class inheriting from
TableGenerator&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;TableGenerator&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;const&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;Int32&lt;/span&gt; SeedValue = 1048576;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;private&lt;/span&gt; &lt;span style="color:blue;"&gt;static&lt;/span&gt; &lt;span style="color:blue;"&gt;readonly&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;ILog&lt;/span&gt; Log = &lt;span style="color:#2b91af;"&gt;LogManager&lt;/span&gt;.GetLogger(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;override&lt;/span&gt; &lt;span style="color:blue;"&gt;object&lt;/span&gt; Generate(&lt;span style="color:#2b91af;"&gt;ISessionImplementor&lt;/span&gt; session, &lt;span style="color:blue;"&gt;object&lt;/span&gt; obj)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;int&lt;/span&gt; counter = &lt;span style="color:#2b91af;"&gt;Convert&lt;/span&gt;.ToInt32(&lt;span style="color:blue;"&gt;base&lt;/span&gt;.Generate(session, obj));&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; counter + SeedValue + 1;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Not much to that is there? Now that is a fairly simple case, but
even getting more complex isn&amp;#39;t much harder than that. You can
implement &lt;code&gt;IIdentifierGenerator &lt;/code&gt;directly and create
something far more customized. TableGenerator actually implements
&lt;code&gt;IPersistentIdentifierGenerator&lt;/code&gt; which is an interface for identifiers
which need to write and updated value to the database. However, since
nHibernate provides so many versatile and inheritable base class
generators that you will likely get by with inheriting one of those and
extending it as I did.&lt;/p&gt;
&lt;p&gt;In order to use this custom generator class I setup my configuration to use it.  Using Fluent I wrote a mapping like this:&lt;/p&gt;
&lt;div style="margin:5px;padding:5px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;class&lt;/span&gt; &lt;span style="color:#2b91af;"&gt;InvestSpecMap&lt;/span&gt; : &lt;span style="color:#2b91af;"&gt;FDPEntityBaseMap&lt;/span&gt;&amp;lt;&lt;span style="color:#2b91af;"&gt;InvestSpec&lt;/span&gt;&amp;gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;{&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap()&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(tablename + &lt;span style="color:#a31515;"&gt;&amp;quot;ID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(FDPGenerator.&lt;span style="color:#2b91af;"&gt;FDPSequence&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//Name of the ID counter table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column for this table&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AnnualDividend).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AnnlzdDiv&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.AssetClass);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CurrencyType);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.CusipNumber).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;CusipNum&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.DividendFreq).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;DivFrequency&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.FullName);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.MaturityDate).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;MaturityDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.PriceAsOf).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;PriceAsOfDt&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.ShortName).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;AbbrName&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TaxTreatment);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.TickerSymbol);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.Type);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; Map(x =&amp;gt; x.UnitPrice);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;You can do the same with XML mappings just declare the assembly and
class as you usually would in XML. This is actually the first time I&amp;#39;ve
used FluentNH.&lt;/p&gt;
&lt;p&gt;What is great about this is that even when testing my mappings with SQLLite, &lt;code&gt;SchemaExport &lt;/code&gt;is
actually able to create the identity table based on the tablename and
columnname properties in the nHibernate configuration. The main benefit
here however is that identity generation remains transparent to the
rest of my application. Also doing something cool with nHibernate,
that&amp;#39;s priceless of course&lt;/p&gt;
&lt;h2&gt;Part 2: Stealing from TableGenerator and controlling DDL generation&lt;/h2&gt;
&lt;p&gt;A while ago I &lt;a href="http://www.lucisferre.org/coding/index.php/2009/07/13/implementing-a-custom-id-generator-for-nhibernate-1"&gt;posted &lt;/a&gt;
about writing a custom id generator using nHibernate and extending one
of the existing Generator classes nHibernate provides.&amp;nbsp; This was done
to support working with a legacy database which uses a custom id
generation strategy.&amp;nbsp; One thing I like to do with all my apps is write
some basic CRUD tests to make sure my mappings and queries are all
working properly.&lt;/p&gt;
&lt;p&gt;To do this I use Oren&amp;#39;s approach of &lt;a href="http://ayende.com/Blog/archive/2009/04/28/nhibernate-unit-testing.aspx"&gt;creating a temporary in-memory database &lt;/a&gt;using SQLite to work with.&amp;nbsp; This involves using the&amp;nbsp; &lt;code&gt;SchemaExport &lt;/code&gt;tool
in nHibernate to generate the DDL to create the database.&amp;nbsp; If you are
using a table generator strategy it also needs to create the table and
columns for the custom id generator.&amp;nbsp; In some cases you may need to
customize the DDL for your Id table.&lt;/p&gt;
&lt;p&gt;&amp;lt;!--{12519956184740}--&amp;gt;&lt;/p&gt;
&lt;p&gt;As I discovered the code to generate the table for a custom id is
only run once per class (and then only on the base class if you are
inheriting).&amp;nbsp; For my id generator there is a separate column used for
each table in the database.&amp;nbsp; So, for example the &lt;i&gt;Price &lt;/i&gt;table has a column in the &lt;i&gt;Counter &lt;/i&gt;table called &lt;i&gt;Price &lt;/i&gt;to store it&amp;#39;s counter and the &lt;i&gt;Holding &lt;/i&gt;table has a column called &lt;i&gt;Holding&lt;/i&gt;.&lt;/p&gt;
&lt;p&gt;The TableGenerator class supports two parameters which are set in the HBM files (or using fluent) &lt;i&gt;tablename &lt;/i&gt;and &lt;i&gt;columnname &lt;/i&gt;which
set the table and column names used for the id counter.&amp;nbsp; If you have a
copy of the nHibernate source code you will see that the TableGenerator
class calls&lt;code&gt; SqlCreateStrings()&lt;/code&gt;and &lt;code&gt;SqlDropString()&lt;/code&gt;
to create and drop the table for the id generator.&amp;nbsp; Unfortunately, as I
mentioned above this is only called once, and so it only creates one
table with one column for whichever mapping is handled first.&lt;/p&gt;
&lt;p&gt;In order to fix this I had to copy the &lt;code&gt;TableGenerator &lt;/code&gt;class (yes, yes, I know copy-paste is bad form) and modify those functions.&amp;nbsp; I also added a third parameter &lt;i&gt;allcolumnnames&lt;/i&gt; in which I can provide a comma separated list of all the columns the table needs to have (one per table in my database).&amp;nbsp; The &lt;code&gt;SqlCreateStrings()&lt;/code&gt;is simple changed to:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; &lt;span style="color:blue;"&gt;string&lt;/span&gt;[] SqlCreateStrings(&lt;span style="color:#2b91af;"&gt;Dialect&lt;/span&gt; dialect) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; create = &lt;span style="color:#a31515;"&gt;&amp;quot;create table &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;string&lt;/span&gt; insert = &lt;span style="color:#a31515;"&gt;&amp;quot;insert into &amp;quot;&lt;/span&gt; + tableName + &lt;span style="color:#a31515;"&gt;&amp;quot; values (&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;foreach&lt;/span&gt; (&lt;span style="color:blue;"&gt;string&lt;/span&gt; s &lt;span style="color:blue;"&gt;in&lt;/span&gt; allcolumns.Split(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;)) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; create += &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + s + &lt;span style="color:#a31515;"&gt;&amp;quot; &amp;quot;&lt;/span&gt; + dialect.GetTypeName(columnSqlType) + &lt;span style="color:#a31515;"&gt;&amp;quot;,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; insert += &lt;span style="color:#a31515;"&gt;&amp;quot; 1,&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; }&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; create = create.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; insert = insert.Trim(&lt;span style="color:#a31515;"&gt;&amp;#39;,&amp;#39;&lt;/span&gt;) + &lt;span style="color:#a31515;"&gt;&amp;quot; )&amp;quot;&lt;/span&gt;;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &lt;span style="color:blue;"&gt;return&lt;/span&gt; &lt;span style="color:blue;"&gt;new&lt;/span&gt;[] {create, insert};&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;(Yes, yes, I know I should have learned from my &lt;a href="http://www.lucisferre.org/coding/index.php/2009/08/04/strings-are-immutable-stupid"&gt;last post &lt;/a&gt;and used a &lt;code&gt;StringBuilder &lt;/code&gt;here as I pointed out in my last post, but seriously, this method will only ever be called once)&lt;/p&gt;
&lt;p&gt;Now when it is called it will create the correct table with all the
columns I need. A couple of example mappings for the database in
FluentNH are shown below:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; InvestSpecMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpecID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;public&lt;/span&gt; PriceMap() {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; WithTable(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;);&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(&lt;span style="color:#a31515;"&gt;&amp;quot;InvestPriceID&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt; (&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestSpec, InvestPrice&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;InvestPrice&amp;quot;&lt;/span&gt;); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;To be completely &amp;quot;clean code&amp;quot; and avoid repeating myself I should probably factor out the &lt;code&gt;Id() &lt;/code&gt;code into a method in an inhereted base class so I can call it from each mapping class like this:&lt;/p&gt;
&lt;div style="margin:16px;padding:8px;background:white none repeat scroll 0% 0%;font-family:Courier New;font-size:8pt;color:black;-moz-background-clip:border;-moz-background-origin:padding;-moz-background-inline-policy:continuous;"&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&lt;span style="color:blue;"&gt;protected&lt;/span&gt; &lt;span style="color:blue;"&gt;void&lt;/span&gt; SetIdGenerator(&lt;span style="color:blue;"&gt;string&lt;/span&gt; tablename) {&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; Id(x =&amp;gt; x.Id).ColumnName(TableName + &lt;span style="color:#a31515;"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .SetGeneratorClass(&lt;span style="color:blue;"&gt;typeof&lt;/span&gt;(&lt;span style="color:#2b91af;"&gt;FdpSequenceGen&lt;/span&gt;).AssemblyQualifiedName)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;allcolumns&amp;quot;&lt;/span&gt;, AllColumns)&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;table&amp;quot;&lt;/span&gt;, &lt;span style="color:#a31515;"&gt;&amp;quot;zSysCounters&amp;quot;&lt;/span&gt;) &lt;span style="color:green;"&gt;//ID counter table name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;&amp;nbsp; &amp;nbsp; .AddGeneratorParam(&lt;span style="color:#a31515;"&gt;&amp;quot;column&amp;quot;&lt;/span&gt;, TableName); &lt;span style="color:green;"&gt;//ID counter column name&lt;/span&gt;&lt;/p&gt;
&lt;p style="margin:0px;padding:0px;"&gt;}&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;Now I can unit test using a temporary in-memory SQLite database and all my tests are passing.&lt;/p&gt;</description></item><item><title>Your first NHibernate based application</title><link>http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-application/revision/0.aspx</link><pubDate>Mon, 21 Dec 2009 22:30:32 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:30</guid><dc:creator>Joe Doyle</dc:creator><description>Current revision posted to How to by Joe Doyle on 21/12/2009 07:30:32 p.m.&lt;br /&gt;
&lt;h2&gt;Your first NHibernate based application&lt;/h2&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="color:#ff8000;"&gt;&lt;span style="background: SpringGreen;"&gt;Wiki&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;extracted&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;from&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;original&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;blog&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;post&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="font-weight:normal;"&gt;&lt;a href="/members/gabriel.schenker/default.aspx"&gt;&lt;span style="background: SpringGreen;"&gt;Gabriel&lt;/span&gt;&amp;nbsp;&lt;span style="font-weight:normal;"&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Schenker&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;h4&gt;&lt;span style="background: SpringGreen;"&gt;Welcome&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;If&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;re&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;reading&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;assume&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ve&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;just&lt;/span&gt; &lt;a href="/media/p/4.aspx"&gt;&lt;span style="background: SpringGreen;"&gt;downloaded&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;/a&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;want&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;started&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tutorial&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;talk&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;through&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="background: SpringGreen;"&gt;Installing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background: SpringGreen;"&gt;Defining&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;simple&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;business&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;object&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background: SpringGreen;"&gt;Create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;load&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;save&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;business&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;object&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background: SpringGreen;"&gt;Configure&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;talk&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;local&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background: SpringGreen;"&gt;Automatically&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;generate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="background: SpringGreen;"&gt;Writing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;simple&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;CRUD&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;pattern&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="background: SpringGreen;"&gt;Using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Unit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Tests&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;make&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sure&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;working&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;correctly&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;what&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;re&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;aiming&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:150px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/solutionex.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;But&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;things&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:)]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Lets&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;actually&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;doing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;something&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ZIP&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;just&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;downloaded&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Installing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;If&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ve&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;downloaded&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;binaries&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;zip&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;all&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;need&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;do&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;extract&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;somewhere&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sensible&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;usually&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;called&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SharedLibs&lt;/span&gt;&amp;nbsp; &lt;code&gt;&lt;span style="background: SpringGreen;"&gt;c:\Code\SharedLibs\NHibernate&lt;/span&gt;&lt;/code&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;extract&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;zip&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;there&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;But&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;whatever&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;re&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;comfortable&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SharedLib&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;from&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;which&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;need&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;references&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NUnit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;dlls&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;references&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;both&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;demo&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;unit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;That&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;!&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;installed&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;easy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;huh)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ll&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;talk&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;through&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Visual&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Studio&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;moment&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;First&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;look&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;at&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;how&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;go&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;about&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;creating&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Note&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;dependent&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;on&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Visual&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Studio&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;2008&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Net&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Framework&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;3.5&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Project&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Before&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;building&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;application&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;business&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;objects&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ll&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;need&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;blank&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;put&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;them&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Fire&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;up&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Visual&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Studio&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Library&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;look&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;at&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;something&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;interesting&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;creating&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;business&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;object&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Defining&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Business&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Objects&lt;/span&gt;&lt;br /&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Lets&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defining&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;very&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;simple&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;For&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;moment&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;consists&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;one&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;entity&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;called&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;has&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;3&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;properties&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Discontinued&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:210px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/ProductDef.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSample&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;solution&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Product.cs&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;very&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;simple&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;uses&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;automatic&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;properties&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;feature&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;C&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;#&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;3.0&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;compiler&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;br /&gt;&lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt;&lt;br /&gt;    &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;bool&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Discontinued&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;    &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;want&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;able&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;persist&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;instances&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;entity&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;relational)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;chosen&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;task&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;An&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;instance&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;entity&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;corresponds&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;row&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;table&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;So&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;between&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;entity&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;corresponding&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;table&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;done&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;either&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defining&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;xml-document&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;or&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;decorating&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;entity&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;attributes&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ll&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Mapping&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Mappings&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSample&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;xml-document&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;call&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;b&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;hbm.xml&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Please&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;note&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;hbm&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;part&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;convention&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;used&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;automatically&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;recognize&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;Embedded&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Resource&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Build&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Action&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;In&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Windows&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Explorer&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;locate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;nhibernate-mapping.xsd&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;src&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;copy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SharedLibs&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;schema&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;definition&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;when&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defining&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;files&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;VS&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;then&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;provide&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;intellisense&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;validation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;when&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;editing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;document&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Back&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;VS&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;schema&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product.hbm.xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/properties.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;now&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Each&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;has&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;lt;hibernate-mapping&amp;gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;root&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;node&lt;/span&gt;&lt;/p&gt;
&lt;div id="scid:F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:73647d35-a397-46d8-ad1c-a9edf8bbe509" class="wlWriterSmartContent"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;?&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;version&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;encoding&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;?&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;hibernate-mapping&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;xmlns&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;urn:nhibernate-mapping-2.2&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;                   &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;assembly&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;FirstSolution&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;                   &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;FirstSolution.Domain&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;  &lt;span style="color:#008000;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;!--&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;more&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;info&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;here&lt;/span&gt; -&lt;span style="text-decoration: line-through; color: red;"&gt;Removed&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;spammer&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;links&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;-&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;hibernate-mapping&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="background: SpringGreen;"&gt;In&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;when&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;referencing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;always&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;provide&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fully&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;qualified&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;e.g.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSample.Domain.Product&lt;/span&gt;, &lt;span style="background: SpringGreen;"&gt;FirstSample)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;To&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;make&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;less&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;verbose&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;assembly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;which&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;classes&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;are&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implemented&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;classes&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;two&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;attributes&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;assembly&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;root&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;node&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;It&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;similar&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;statement&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;C#&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;primary&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;key&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;entity&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Technically&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;could&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;take&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;since&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;must&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defined&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;has&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;unique&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;But&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;common&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;surrogate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;key&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;instead&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;For&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;thus&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;entity&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;call&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Id&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Guid&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;type&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Id&lt;/span&gt; but &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; can &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;well&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;int&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;or&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;long&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;System&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;br /&gt;&lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt;&lt;br /&gt;    &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Guid&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Id&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;bool&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Discontinued&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;    &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;complete&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;?&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;version&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;encoding&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;?&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;hibernate-mapping&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;xmlns&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;urn:nhibernate-mapping-2.2&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;                   &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;assembly&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;FirstSolution&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;                   &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;FirstSolution.Domain&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Product&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;id&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;generator&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;guid&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;id&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Category&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Discontinued&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;hibernate-mapping&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;doesn&lt;/span&gt;&amp;#39;t &lt;span style="text-decoration: line-through; color: red;"&gt;restore&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;way&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;such&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defines&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;many&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;reasonable&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defaults&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;So&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;if&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;don&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;t&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;provide&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;column&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;explicitly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt; the &lt;span style="text-decoration: line-through; color: red;"&gt;original&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;content&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;due&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;column&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;according&lt;/span&gt; to &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Or&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;automatically&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;infer&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;table&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;or&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;type&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;column&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;from&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;definition&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;consequence&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;my&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;not&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;cluttered&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;redundant&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;information&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Please&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;refer&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;online&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;documentation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;more&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;detailed&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;explanation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;You&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;find&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/mapping.html"&gt;&lt;span style="background: SpringGreen;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;solution&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;explorer&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;should&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;look&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;like&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Domain.cd&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;contains&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;diagram&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;simple&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;You&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;added&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;design&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;created&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;diagram&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;yourself&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;although&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;good&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;practice&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;not&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;required&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;purposes&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;excercise&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:150px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/solutionex.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Configure&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tell&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;which&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;want&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;provide&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;connection&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;details&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;form&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;connection&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;supports&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;many&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;many&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;products&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;call&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;hibernate.cfg.xml&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Set&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;its&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Copy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Output&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Copy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;always&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Since&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;are&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SQL&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Server&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Compact&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Edition&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sample&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;enter&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;information&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;into&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;?&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;version&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;encoding&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;?&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;hibernate-configuration&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;xmlns&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;urn:nhibernate-configuration-2.2&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;session-factory&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;connection.provider&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;NHibernate.Connection.DriverConnectionProvider&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;dialect&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;NHibernate.Dialect.MsSqlCeDialect&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;connection.driver_class&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;NHibernate.Driver.SqlServerCeDriver&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;connection.connection_string&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Data&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Source=FirstSample.sdf&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;show_sql&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;true&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;session-factory&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="background: SpringGreen;"&gt;hibernate-configuration&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;With&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configuration&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tell&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;want&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;MS&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SQL&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Server&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Compact&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Edition&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;target&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;shall&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSample.sdf&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;=connection&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;string)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;also&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defined&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;want&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;see&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;SQL&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;generates&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sends&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;highly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;recommended&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;debugging&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;purposes&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;during&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;development)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Double&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;check&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;no&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;typos&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; an &lt;span style="text-decoration: line-through; color: red;"&gt;error&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;empty&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;called&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;FirstSample.sdf&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSample&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;choose&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Local&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Database&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;template&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/AddNewItem.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Click&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ignore&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;DataSet&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;creation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;wizard&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;just&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;hit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Cancel)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Setup&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;It&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;time&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;setup&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;First&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;verify&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;files&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SharedLibs&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:180px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/SharedLibs.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;last&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;8&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;files&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;find&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Microsoft&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SQL&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Server&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Compact&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Edition&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;directory&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Programs&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/sqlce.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Note&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;System.Data.SqlServerCe.dll&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;located&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sub-folder&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Desktop&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;All&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;other&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;files&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;found&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;reference&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSample&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Additionally&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;references&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate.dll&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;nunit.framework.dll&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Systm.Data.SqlServerCe.dll&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;remember&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;reference&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;files&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;located&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SharedLibs&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder!)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Pay&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;attention&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;property&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Copy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Local&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;true&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;assembly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;System.Data.SqlServerCe.dll&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;since&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;default&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;false&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;!&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;copy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;hibernate.cfg.xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;root&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;unit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Direct&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;action&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NUnit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;needs&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;access&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;called&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;GenerateSchema_Fixture&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;should&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;look&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;like&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:120px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/solutionex1.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;further&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;need&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;7&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;files&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sqce*.dll&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;output&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;directory&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;do&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;post-build&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;event&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;VS&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Enter&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;command&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;Post-build&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;event&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;command&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;line&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;copy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;$&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(ProjectDir)..\..\SharedLibs\sqlce*.dll&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;$&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(ProjectDir)$(OutDir)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/AppProperties.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GenerateSchema_Fixture&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:370px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate.Cfg&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate.Tool.hbm2ddl&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NUnit.Framework&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution.Tests&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;TestFixture]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GenerateSchema_Fixture&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Test]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Can_generate_schema(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;cfg&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Configuration()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;cfg.Configure()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;cfg.AddAssembly&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;typeof&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Product).Assembly);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SchemaExport(cfg).Execute&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;line&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;creates&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;instance&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configuration&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;used&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configure&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;In&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;second&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;line&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tell&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configure&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;itself&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;look&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;out&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configuration&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;information&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;since&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;do&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;not&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;provide&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;any&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;information&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;here&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;So&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;search&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;called&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;hibernate.cfg.xml&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;output&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;directory&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;That&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;exactly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;what&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;want&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;since&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defined&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;settings&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;In&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;third&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;line&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tell&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;find&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;information&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;assembly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;which&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;contains&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;also&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;At&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;time&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;being&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;find&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;one&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;such&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Product.hbm.xml)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;embedded&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;resource&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fourth&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;line&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;uses&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SchemaExport&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;helper&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;auto&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;-&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;magically&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;generate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;schema&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;us&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SchemaExport&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;table&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;each&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;time&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;call&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;delete&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;table&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;table&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;data&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;recreate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Note&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;do&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;NOT&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;want&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;find&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;out&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;whether&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;does&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;its&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;job&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;correctly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sure&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;does&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;but&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;rater&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;whether&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;setup&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;system&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;correctly&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;However&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;check&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;see&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;newly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;created&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;table&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;If&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;a href="http://www.testdriven.net/"&gt;&lt;span style="background: SpringGreen;"&gt;TestDriven.Net&lt;/span&gt;&lt;/a&gt; &lt;span style="background: SpringGreen;"&gt;installed&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;just&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;right&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;click&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;inside&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;choose&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Run&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Test(s&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;execute&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/RunTest.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;If&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;every&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;thing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ok&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;should&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;see&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;result&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;output&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;window&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/TestResult.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;If&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;a href="http://www.jetbrains.com/resharper/"&gt;&lt;span style="background: SpringGreen;"&gt;ReSharper&lt;/span&gt;&lt;/a&gt; &lt;span style="background: SpringGreen;"&gt;installed&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;just&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;clicking&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;yellow-green&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;circle&lt;/span&gt; on the &lt;span style="text-decoration: line-through; color: red;"&gt;site&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;left&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;border&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;choose&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Run&lt;/span&gt;&lt;/b&gt;.&amp;nbsp; &lt;span style="text-decoration: line-through; color: red;"&gt;Use&lt;/span&gt; &lt;/p&gt;
&lt;p style="padding-left:120px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/RSTestinfo.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;result&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;follows&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:90px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/RSRunTest.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;In&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;case&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Problems&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;If&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fails&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;double&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;check&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;find&lt;/span&gt; the &lt;span style="text-decoration: line-through; color: red;"&gt;History&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;tab&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;files&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;target&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;directory&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;m:dev\projects\FirstSolution\src\FirstSolution.Tests\bin\debug&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:150px;"&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/InCaseOfPb.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Double&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;check&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;also&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;if&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;no&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;typos&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configuration&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;hibernate.cfg.xml)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;or&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Product.hbm.xml).&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Finally&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;check&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;whether&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Build&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Action&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Product.hbm.xml)&lt;/span&gt; to &lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Embedded&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Resource&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;continue&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;if&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;succeeds&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;CRUD&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;operations&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;obviously&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;system&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ready&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;successfully&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implemented&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Domain&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defined&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;files&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configured&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Finally&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;used&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;automatically&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;generate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;schema&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;from&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;files)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;In&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;spirit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;DDD&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;see&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;e.g&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;a href="http://domaindrivendesign.org/books/"&gt;&lt;span style="background: SpringGreen;"&gt;Domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Driven&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Design&lt;/span&gt;&lt;/a&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Eric&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Evans&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;all&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;crud&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;operations&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;create,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;read&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;update&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;delete)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;interface&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;part&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;where&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implementation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;not&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;!&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implementation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;infrastructure&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;specific&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;want&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;keep&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;persistence&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ignorant&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;PI).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;interface&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Call&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;interface&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:269px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;System&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;System.Collections.Generic&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;interface&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Update(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Remove(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetById(Guid&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;productId)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByName&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;ICollection&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByCategory&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;category)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository_Fixture&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;solution&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:270px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;TestFixture]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository_Fixture&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ISessionFactory&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;sessionFactory;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Configuration&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;configuration;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;TestFixtureSetUp]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;TestFixtureSetUp(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;configuration&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Configuration()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;configuration.Configure();&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;configuration.AddAssembly(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;typeof&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Product).Assembly);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;sessionFactory&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;configuration.BuildSessionFactory();&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;In&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fourth&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;line&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;TestFixtureSetUp&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;factory&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;expensive&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;process&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;should&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;thus&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;executed&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;once&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;That&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;reason&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;why&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;put&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;into&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;which&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;executed&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;once&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;during&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;cycle&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;To&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;keep&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;methods&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;side&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;effect&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;free&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;re-create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;schema&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;before&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;execution&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;each&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Thus&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;SetUp]&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SetupContext(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SchemaExport(_configuration).Execute&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;And&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implement&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;instance&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;adding&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;called&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Repositories&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;FirstSolution&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;project&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;ProductRepository&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;folder&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Make&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;ProductRepository&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;inherit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;from&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;interface&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:652px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;System&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;System.Collections.Generic&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution.Repositories&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Update(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Remove(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetById(Guid&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;productId&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByName&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ICollection&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByCategory&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;category&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h6&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Manipulating&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Data&lt;/span&gt;&lt;/b&gt;&lt;/h6&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;go&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;back&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository_Fixture&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implement&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;      &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Test]&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Can_add_new_product(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Apple&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Fruits&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;repository.Add(product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;run&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fail&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;since&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;not&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;yet&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implemented&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;do&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;But&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;wait&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;little&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;helper&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;which&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;provides&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;us&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;objects&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;on&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;demand&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:523px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate.Cfg&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;FirstSolution.Repositories&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernateHelper&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ISessionFactory&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;sessionFactory;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ISessionFactory&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SessionFactory&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;_sessionFactory&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;null&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                    &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configuration&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Configuration()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                    &lt;span style="background: SpringGreen;"&gt;configuration.Configure()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                    &lt;span style="background: SpringGreen;"&gt;configuration.AddAssembly&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Product).Assembly);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                    &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;sessionFactory&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configuration.BuildSessionFactory()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;sessionFactory;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;OpenSession(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SessionFactory.OpenSession()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;creates&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;factory&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;time&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;client&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;needs&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;follows&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernateHelper.OpenSession()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ITransaction&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;transaction&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session.BeginTransaction()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;session.Save(product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;transaction.Commit()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;second&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;run&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;again&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fail&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;message&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/ShouldBeVirtual.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;That&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;because&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;default&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configured&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt;&lt;b&gt;&amp;nbsp;&lt;a href="http://martinfowler.com/eaaCatalog/lazyLoad.html"&gt;&lt;span style="background: SpringGreen;"&gt;lazy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;load&lt;/span&gt;&lt;/a&gt;&lt;/b&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;all&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;entities&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;That&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;recommended&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;approach&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;warmly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;recommend&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;not&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;change&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;maximum&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;flexibility&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;How&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;solve&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;issue&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;?&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;It&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;easy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;just&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;make&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;all&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;properties&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;methods&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;object(s&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;virtual&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;do&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt;&lt;br /&gt;    &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;virtual&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Guid&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Id&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;virtual&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;virtual&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;virtual&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;bool&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Discontinued&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;set&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;    &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;run&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;again&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;It&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;should&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;succeed&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;output&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/TestOutput.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Note&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sql&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;spit&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;out&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;think&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;successfully&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;inserted&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;into&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;But&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;whether&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;really&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;so&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;extend&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;our&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:313px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Test]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Can_add_new_product(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Apple&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Fruits&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;repository.Add(product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#008000;"&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;try&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;load&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;sessionFactory.OpenSession())&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session.Get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;(product.Id);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="color:#008000;"&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;was&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;successfully&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;inserted&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="background: SpringGreen;"&gt;Assert.IsNotNull(fromDb)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="background: SpringGreen;"&gt;Assert.AreNotSame(product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="background: SpringGreen;"&gt;Assert.AreEqual(product.Name&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb.Name)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="background: SpringGreen;"&gt;Assert.AreEqual(product.Category&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb.Category)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Run&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;again&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Hopefully&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;succeed..&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;are&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ready&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implement&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;also&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;other&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;methods&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;For&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;testing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;would&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;rather&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;table&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;already&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;containing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;some&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;products&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Nothing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;easier&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;than&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Just&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;CreateInitialData&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;class&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;follows&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:355px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;readonly&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;]&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;products&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                 &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Melon&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Fruits&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Pear&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Fruits&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Milk&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Beverages&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Coca&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Cola&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Beverages&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Pepsi&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Cola&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Category&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Beverages&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                 &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;CreateInitialData(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;sessionFactory.OpenSession())&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ITransaction&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;transaction&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session.BeginTransaction()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;foreach&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;products)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                        &lt;span style="background: SpringGreen;"&gt;session.Save(product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                    &lt;span style="background: SpringGreen;"&gt;transaction.Commit()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Call&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;from&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SetupContext&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;after&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;create&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;schema&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;call&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;are&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;done&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;each&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;time&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;after&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;schema&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;created&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;populated&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;some&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;products&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Update&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:269px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Test]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Can_update_existing_product(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;products[0];&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;product.Name&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Yellow&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Pear&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;repository.Update(product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#008000;"&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;/&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;try&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;load&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;sessionFactory.OpenSession())&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session.Get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;(product.Id);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="background: SpringGreen;"&gt;Assert.AreEqual(product.Name&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb.Name)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;When&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;running&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;time&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;will&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fail&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;since&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Update&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;has&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;not&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;yet&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;been&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implemented&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Note&lt;/span&gt;&lt;/b&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;expected&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;behavior&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;since&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;TDD&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;time&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;run&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;should&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;always&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fail&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Analogous&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implement&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Update&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;difference&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;call&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;update&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;object&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;instead&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;save&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Update(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernateHelper.OpenSession()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ITransaction&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;transaction&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session.BeginTransaction()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;session.Update(product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;transaction.Commit()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Run&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;again&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;watch&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;it&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;succeed&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/TestSucceed.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;delete&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;straight&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;forward&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;When&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;testing&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;whether&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;record&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;has&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;really&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;been&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;deleted&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;just&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;assert&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;value&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;returned&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;equal&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;null&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Here&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:227px;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;       &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Test]&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Can_remove_existing_product(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;products[0];&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;repository.Remove(product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;_&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;sessionFactory.OpenSession())&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session.Get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;(product.Id);&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;Assert.IsNull(fromDb)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;here&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implementation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Remove&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Remove(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernateHelper.OpenSession()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ITransaction&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;transaction&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session.BeginTransaction()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;session.Delete(product)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;transaction.Commit()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h6&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Querying&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Database&lt;/span&gt;&lt;/b&gt;&lt;/h6&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;We&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;still&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implement&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;three&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;methods&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;which&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;query&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;objects&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;most&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;easy&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;one&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetById&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;First&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;write&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Test]&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Can_get_existing_product_by_id(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository.GetById(_products[1].Id)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;Assert.IsNotNull(fromDb)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;Assert.AreNotSame(_products[1]&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;Assert.AreEqual(_products[1].Name&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb.Name)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;then&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fulfill&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetById(Guid&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;productId&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernateHelper.OpenSession()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session.Get&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;(productId);&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Now&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;was&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;easy&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;For&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;two&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;methods&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;use&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;object&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByName&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;usual&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;we&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;write&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;       &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Test]&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Can_get_existing_product_by_name(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository.GetByName(_products[1].Name)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;Assert.IsNotNull(fromDb)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;Assert.AreNotSame(_products[1]&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;Assert.AreEqual(_products[1].Id&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb.Id)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implementation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByName&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;done&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;two&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;different&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;approaches&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;first&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;HQL&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Hibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Query&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Language&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;second&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;one&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;HCQ&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Hibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Criteria&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Query)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Let&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;start&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;HQL&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;HQL&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;object&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;oriented&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;query&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;language&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;similar&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;but&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;not&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;equal&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SQL&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;To&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;added&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implemetation&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByName&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;HQL&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Implement&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;HCQ&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;below&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;works&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;expected&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;returns&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;entity&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;In&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;above&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sample&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;introduced&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;commonly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;used&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;technique&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;when&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;It&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;s&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;called&lt;/span&gt; &lt;a href="http://en.wikipedia.org/wiki/Fluent_interface"&gt;&lt;span style="background: SpringGreen;"&gt;fluent&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;interfaces&lt;/span&gt;&lt;/a&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;As&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;result&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;less&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;verbose&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;easier&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;understand&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;You&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;see&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;HQL&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;query&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;which&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;embedded&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;named)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;parameters&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Parameters&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;are&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;prefixed&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;:&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;defines&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;many&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;helper&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;methods&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;like&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SetString&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;used&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;example&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;assign&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;values&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;various&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;types&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;those&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;parameters&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Finally&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;UniqueResult&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tell&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;expect&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;one&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;record&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;return&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;If&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;more&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;than&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;one&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;record&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;returned&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;by&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;HQL&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;query&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;then&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;exception&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;raised&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;To&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;get&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;more&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;information&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;about&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;HQL&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;please&lt;/span&gt; read &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/queryhql.html"&gt;&lt;span style="background: SpringGreen;"&gt;online&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;documentation&lt;/span&gt;&lt;/a&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;second&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;version&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;uses&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;criteria&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;query&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;search&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;requested&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;You&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;need&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;add&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;reference&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;NHibernate.Criterion&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;on&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;page&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByName&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernateHelper.OpenSession()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;CreateCriteria(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Product))&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Add(Restrictions.Eq(&lt;/span&gt;&lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;name)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;UniqueResult&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;();&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;Many&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;users&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;think&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;that&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;approach&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;more&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;object&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;oriented&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;On&lt;/span&gt; the &lt;span style="background: SpringGreen;"&gt;other&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;hand&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;complex&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;query&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;written&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;with&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;criteria&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;syntax&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;quickly&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;become&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;difficult&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;understand&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;last&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implement&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;is&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByCategory&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;This&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;returns&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;list&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;products&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;The&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implemented&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;follows&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:314px;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="background: SpringGreen;"&gt;[&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Test]&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Can_get_existing_products_by_category(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;IProductRepository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;repository.GetByCategory&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Fruits&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;Assert.AreEqual(2&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb.Count)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;Assert.IsTrue(IsInCollection(_products[0]&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb))&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;Assert.IsTrue(IsInCollection(_products[1]&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb))&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;bool&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;IsInCollection(Product&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;product&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ICollection&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;foreach&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;item&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;fromDb&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;if&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;product.Id&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;item.Id&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;                    &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;method&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;itself&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;might&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;contain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;following&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;code&lt;/span&gt;&lt;/p&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;ICollection&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;GetByCategory&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;category&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;ISession&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernateHelper.OpenSession()&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;{&lt;/span&gt;&lt;br /&gt;                &lt;span style="background: SpringGreen;"&gt;var&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;products&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;=&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;session&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;CreateCriteria(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Product))&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Add(Restrictions.Eq(&lt;/span&gt;&lt;span style="color:#006080;"&gt;&lt;span style="background: SpringGreen;"&gt;&amp;quot;Category&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;category)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;)&lt;/span&gt;&lt;br /&gt;                    &lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;List&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;lt;Product&amp;gt;();&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="background: SpringGreen;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;products&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="background: SpringGreen;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="background: SpringGreen;"&gt;Summary&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="background: SpringGreen;"&gt;In&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;this&lt;/span&gt; article &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;shown&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;how&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;implement&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;basic&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sample&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;define&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;mapping&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;a&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;how&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;configure&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;able&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;persist&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;objects&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;in&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;shown&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;how&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;typically&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;write&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;test&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;CRUD&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;methods&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;for&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;your&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;domain&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;objects&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;I&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;taken&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;MS&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;SQL&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Compact&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Edition&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;as&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;sample&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;but&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;any&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;other&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;supported&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;be&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;used&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;you&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;only&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;change&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;hibernate.cfg.xml&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;file&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;accordingly)&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;Ee&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;have&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;no&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;dependencies&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;on&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;external&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;frameworks&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;or&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tools&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;other&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;than&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;database&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;and&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;NHibernate&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;itself&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;(&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.NET&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;of&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;course&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;never&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;counts&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;here)&lt;/span&gt;.&lt;/p&gt;</description></item><item><title>Your first NHibernate based application</title><link>http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-application/revision/12.aspx</link><pubDate>Mon, 21 Dec 2009 22:30:17 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:301</guid><dc:creator>Joe Doyle</dc:creator><description>Revision 12 posted to How to by Joe Doyle on 21/12/2009 07:30:17 p.m.&lt;br /&gt;
&lt;h2&gt;Your first NHibernate based application&lt;/h2&gt;
&lt;p&gt;&lt;a href="http://www.dicapriophotography.com"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;san&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;diego&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;wedding&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;photographer&lt;/span&gt;&lt;/a&gt;
&lt;a href="http://www.dicapriophotography.com"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;san&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;diego&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;wedding&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;photographers&lt;/span&gt;&lt;p&gt;&lt;a href="http://www.dicapriophotography.com"&gt;&lt;span style="background: SpringGreen;"&gt;-&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;Removed&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;spammer&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;links&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;,&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;but&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;can&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;t&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;restore&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;original&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;content&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;due&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;an&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;error&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;on&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;site&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&amp;nbsp; &lt;span style="background: SpringGreen;"&gt;Use&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;History&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;tab&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;to&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;read&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;the&lt;/span&gt; &lt;span style="background: SpringGreen;"&gt;article&lt;/span&gt;&lt;span style="background: SpringGreen;"&gt;.&lt;/span&gt;&lt;br /&gt;&lt;/a&gt;&lt;a href="http://www.dicapriophotography.com"&gt;&lt;/a&gt;&lt;/p&gt;</description></item><item><title>Your first NHibernate based application</title><link>http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-application/revision/11.aspx</link><pubDate>Mon, 21 Dec 2009 07:32:56 GMT</pubDate><guid isPermaLink="false">45f813f2-f1c4-4eda-a619-288e3cadc793:300</guid><dc:creator>raymond456</dc:creator><description>Revision 11 posted to How to by raymond456 on 21/12/2009 04:32:56 a.m.&lt;br /&gt;
&lt;h2&gt;Your first NHibernate based application&lt;/h2&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="color:#ff8000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Wiki&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;extracted&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;from&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;original&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;blog&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;post&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt;&lt;/span&gt;&amp;nbsp;&lt;span style="font-weight:normal;"&gt;&lt;a href="/members/gabriel.schenker/default.aspx"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Gabriel&lt;/span&gt;&amp;nbsp;&lt;span style="font-weight:normal;"&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Schenker&lt;/span&gt;&lt;/b&gt;&lt;/span&gt;&lt;/a&gt;&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;h4&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Welcome&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;If&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;re&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;reading&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;assume&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ve&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;just&lt;/span&gt; &lt;a href="/media/p/4.aspx"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;downloaded&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;/a&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;want&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;started&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;This&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;tutorial&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;talk&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;through&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Installing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Defining&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;simple&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;business&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;object&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;an&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;load&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;save&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;business&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;object&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Configure&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;talk&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;local&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Automatically&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;generate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt;&amp;nbsp;&lt;/li&gt;
&lt;li&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Writing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;simple&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;CRUD&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Repository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;pattern&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Using&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Unit&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Tests&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;make&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;sure&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;working&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;correctly&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;This&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;what&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;re&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;aiming&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;:&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:150px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/solutionex.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;But&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;things&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;:)]&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Lets&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;start&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;actually&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;doing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;something&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ZIP&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;just&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;downloaded&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Installing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;If&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ve&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;downloaded&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;binaries&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;zip&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;all&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;need&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;do&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;extract&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;somewhere&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;sensible&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;I&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;usually&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;called&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SharedLibs&lt;/span&gt;&amp;nbsp; &lt;code&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;c:\Code\SharedLibs\NHibernate&lt;/span&gt;&lt;/code&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;extract&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;zip&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;there&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;But&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;whatever&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;re&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;comfortable&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;This&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SharedLib&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;from&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;which&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;need&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;references&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NUnit&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;dlls&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;references&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;both&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;demo&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;unit&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;That&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;!&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;installed&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;easy&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;huh)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ll&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;talk&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;through&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Visual&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Studio&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;moment&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;First&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;let&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;look&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;at&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;how&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;go&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;about&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;creating&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Note&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;dependent&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;on&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Visual&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Studio&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;2008&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Net&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Framework&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;3.5&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Project&lt;/span&gt;&lt;/b&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Before&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;start&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;building&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;application&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;business&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;objects&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ll&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;need&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;blank&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;put&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;them&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Fire&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;up&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Visual&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Studio&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Library&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Let&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;look&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;at&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;something&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;interesting&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;:&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;creating&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;business&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;object&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Defining&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Business&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Objects&lt;/span&gt;&lt;br /&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Lets&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;start&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;defining&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;very&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;simple&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;For&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;moment&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;consists&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;one&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;entity&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;called&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;has&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;3&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;properties&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Discontinued&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:210px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/ProductDef.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSample&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;solution&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Product.cs&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;very&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;simple&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;uses&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;automatic&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;properties&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;feature&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;C&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;#&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;3.0&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;compiler&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt; &lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;br /&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt;&lt;br /&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;bool&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Discontinued&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;want&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;be&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;able&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;persist&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;instances&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;entity&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;relational)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;chosen&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;task&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;An&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;instance&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;an&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;entity&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;corresponds&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;row&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;table&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;So&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;between&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;entity&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;corresponding&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;table&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;This&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;be&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;done&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;either&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;defining&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;an&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;xml-document&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;or&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;decorating&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;entity&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;attributes&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;I&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ll&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;start&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Mapping&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Mappings&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSample&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;xml-document&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;call&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;b&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;hbm.xml&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Please&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;note&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;hbm&amp;quot;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;part&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;This&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;convention&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;used&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;automatically&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;recognize&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Embedded&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Resource&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Build&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Action&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;In&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Windows&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Explorer&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;locate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;nhibernate-mapping.xsd&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;src&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;copy&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SharedLibs&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;use&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;schema&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;definition&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;when&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;defining&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;files&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;VS&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;then&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;provide&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;intellisense&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;validation&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;when&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;editing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;an&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;document&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Back&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;VS&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;schema&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product.hbm.xml&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/properties.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Let&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;start&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;now&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Each&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;has&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;hibernate-mapping&amp;gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;root&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;node&lt;/span&gt;&lt;/p&gt;
&lt;div id="scid:F2210F5F-69EB-4d4c-AFF7-B8A050E9CC72:73647d35-a397-46d8-ad1c-a9edf8bbe509" class="wlWriterSmartContent"&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;?&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;version&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;encoding&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;?&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;hibernate-mapping&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;xmlns&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;urn:nhibernate-mapping-2.2&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;                   &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;assembly&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;FirstSolution&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;                   &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;FirstSolution.Domain&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;  &lt;span style="color:#008000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;!--&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;more&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;info&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;here&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;-&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;-&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;hibernate-mapping&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;div&gt;&lt;/div&gt;
&lt;div&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;In&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;when&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;referencing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;always&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;provide&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fully&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;qualified&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;e.g.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSample.Domain.Product&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSample)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;To&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;make&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;less&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;verbose&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;assembly&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;which&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;classes&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;are&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implemented&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;classes&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;two&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;attributes&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;assembly&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;root&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;node&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;It&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;similar&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;statement&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;C#&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/div&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;primary&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;key&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;entity&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Technically&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;could&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;take&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;since&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;must&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;be&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;defined&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;has&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;be&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;unique&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;But&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;common&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;use&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;surrogate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;key&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;instead&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;For&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;thus&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;entity&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;call&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Id&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;use&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Guid&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;type&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Id&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;but&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;well&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;be&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;an&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;int&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;or&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;long&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;System&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;br /&gt; &lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;br /&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt;&lt;br /&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Guid&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Id&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;bool&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Discontinued&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;complete&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;?&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;version&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;encoding&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;?&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;hibernate-mapping&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;xmlns&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;urn:nhibernate-mapping-2.2&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;                   &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;assembly&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;FirstSolution&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;br /&gt;                   &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;FirstSolution.Domain&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Product&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;id&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Id&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;      &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;generator&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;guid&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;id&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Name&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Category&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Discontinued&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;hibernate-mapping&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;doesn&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;t&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;way&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;such&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;defines&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;many&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;reasonable&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;defaults&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;So&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;if&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;don&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;t&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;provide&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;column&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;explicitly&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;column&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;according&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Or&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;automatically&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;infer&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;table&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;or&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;type&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;column&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;from&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;definition&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;As&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;consequence&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;my&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;not&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;cluttered&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;redundant&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;information&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Please&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;refer&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;online&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;documentation&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;more&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;detailed&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;explanation&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;You&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;find&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/mapping.html"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;here&lt;/span&gt;&lt;/a&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;solution&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;explorer&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;should&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;look&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;like&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Domain.cd&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;contains&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;diagram&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;simple&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;You&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;added&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;design&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;created&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;diagram&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;yourself&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;although&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;good&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;practice&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;not&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;required&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;purposes&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;excercise&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:150px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/solutionex.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Configure&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;tell&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;which&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;want&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;use&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;provide&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;connection&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;details&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;form&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;connection&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;supports&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;many&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;many&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;products&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;call&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;hibernate.cfg.xml&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Set&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;its&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Copy&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Output&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Copy&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;always&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Since&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;are&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SQL&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Server&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Compact&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Edition&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;sample&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;enter&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;information&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;into&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;?&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;xml&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;version&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;1.0&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;encoding&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;utf-8&amp;quot;&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;?&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;hibernate-configuration&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;xmlns&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;urn:nhibernate-configuration-2.2&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;session-factory&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;connection.provider&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate.Connection.DriverConnectionProvider&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;dialect&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate.Dialect.MsSqlCeDialect&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;connection.driver_class&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate.Driver.SqlServerCeDriver&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;connection.connection_string&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Data&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Source=FirstSample.sdf&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;    &lt;br /&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#ff0000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;show_sql&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;true&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;  &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;session-factory&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;/&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#800000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;hibernate-configuration&lt;/span&gt;&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;gt;&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;With&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configuration&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;tell&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;want&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;use&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;MS&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SQL&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Server&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Compact&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Edition&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;target&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;shall&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;be&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSample.sdf&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=connection&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;string)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;also&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;defined&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;want&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;see&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;SQL&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;generates&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;sends&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;highly&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;recommended&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;debugging&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;purposes&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;during&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;development)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Double&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;check&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;no&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;typos&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;an&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;empty&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;called&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;FirstSample.sdf&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSample&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;choose&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Local&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Database&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;template&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/AddNewItem.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Click&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ignore&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;DataSet&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;creation&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;wizard&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;just&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;hit&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Cancel)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Setup&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;It&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;time&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;setup&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;First&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;verify&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;files&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SharedLibs&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:180px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/SharedLibs.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;last&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;8&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;files&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;find&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Microsoft&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SQL&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Server&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Compact&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Edition&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;directory&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Programs&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/sqlce.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Note&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;:&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;System.Data.SqlServerCe.dll&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;located&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;sub-folder&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Desktop&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;All&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;other&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;files&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;be&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;found&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;reference&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSample&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Additionally&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;references&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate.dll&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;nunit.framework.dll&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Systm.Data.SqlServerCe.dll&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;remember&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;reference&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;files&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;located&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SharedLibs&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder!)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Pay&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;attention&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;property&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Copy&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Local&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;true&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;assembly&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;System.Data.SqlServerCe.dll&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;since&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;default&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;false&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;!&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;copy&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;hibernate.cfg.xml&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;root&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;unit&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Direct&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;action&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NUnit&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;needs&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;access&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;called&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;GenerateSchema_Fixture&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;should&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;look&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;like&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:120px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/solutionex1.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;further&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;need&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;7&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;files&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;sqce*.dll&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;output&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;directory&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;do&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;post-build&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;event&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;VS&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Enter&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;command&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Post-build&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;event&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;command&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;line&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;copy&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;$&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(ProjectDir)..\..\SharedLibs\sqlce*.dll&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;$&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(ProjectDir)$(OutDir)&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/AppProperties.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;GenerateSchema_Fixture&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:370px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate.Cfg&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate.Tool.hbm2ddl&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NUnit.Framework&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution.Tests&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;TestFixture]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;GenerateSchema_Fixture&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Test]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Can_generate_schema(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;var&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;cfg&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Configuration()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;cfg.Configure()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;cfg.AddAssembly&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;typeof&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Product).Assembly);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SchemaExport(cfg).Execute&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;line&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;creates&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;instance&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configuration&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;This&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;used&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configure&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;In&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;second&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;line&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;tell&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configure&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;itself&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;look&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;out&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configuration&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;information&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;since&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;do&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;not&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;provide&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;any&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;information&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;here&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;So&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;search&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;called&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;hibernate.cfg.xml&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;output&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;directory&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;That&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;exactly&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;what&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;want&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;since&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;defined&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;settings&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;In&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;third&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;line&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;tell&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;find&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;information&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;assembly&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;which&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;contains&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;also&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;At&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;time&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;being&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;only&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;find&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;one&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;such&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Product.hbm.xml)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;an&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;embedded&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;resource&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fourth&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;line&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;uses&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SchemaExport&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;helper&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;auto&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;-&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;magically&amp;quot;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;generate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;schema&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;us&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SchemaExport&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;table&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;each&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;time&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;call&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;delete&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;table&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;table&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;data&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;recreate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Note&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;:&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;do&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;NOT&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;want&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;find&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;out&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;whether&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;does&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;its&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;job&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;correctly&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;be&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;sure&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;does&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;but&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;rater&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;whether&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;setup&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;system&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;correctly&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;However&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;check&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;see&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;newly&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;created&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;table&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;If&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;a href="http://www.testdriven.net/"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;TestDriven.Net&lt;/span&gt;&lt;/a&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;installed&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;just&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;right&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;click&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;inside&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;choose&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Run&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Test(s&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;execute&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/RunTest.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;If&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;every&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;thing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ok&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;should&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;see&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;result&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;output&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;window&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:30px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/TestResult.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;If&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;a href="http://www.jetbrains.com/resharper/"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ReSharper&lt;/span&gt;&lt;/a&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;installed&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;just&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;start&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;clicking&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;yellow-green&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;circle&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;on&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;left&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;border&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;choose&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Run&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:120px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/RSTestinfo.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;result&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;follows&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:90px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/RSRunTest.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;In&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;case&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Problems&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;If&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fails&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;double&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;check&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;find&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;files&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;target&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;directory&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;:&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;m:dev\projects\FirstSolution\src\FirstSolution.Tests\bin\debug&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/p&gt;
&lt;p style="padding-left:150px;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/InCaseOfPb.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Double&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;check&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;also&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;if&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;no&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;typos&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configuration&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;hibernate.cfg.xml)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;or&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Product.hbm.xml).&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Finally&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;check&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;whether&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Build&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Action&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;file&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Product.hbm.xml)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Embedded&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Resource&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Only&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;continue&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;if&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;succeeds&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;h4&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;CRUD&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;operations&lt;/span&gt;&lt;/b&gt;&lt;/h4&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;obviously&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;system&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ready&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;start&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;successfully&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implemented&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Domain&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;defined&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;files&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configured&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Finally&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;used&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;automatically&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;generate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;schema&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;from&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;mapping&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;files)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;In&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;spirit&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;DDD&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;see&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;e.g&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;a href="http://domaindrivendesign.org/books/"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Driven&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Design&lt;/span&gt;&lt;/a&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Eric&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Evans&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;all&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;crud&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;operations&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;create,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;read&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;update&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;delete)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;interface&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;part&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;where&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implementation&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;not&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;!&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implementation&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;infrastructure&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;specific&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;We&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;want&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;keep&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;persistence&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ignorant&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;PI).&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;interface&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Call&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;IProductRepository&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Let&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;interface&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:269px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;System&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;System.Collections.Generic&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;interface&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;IProductRepository&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add(Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Update(Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Remove(Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;GetById(Guid&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;productId)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;GetByName&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;name)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;ICollection&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;Product&amp;gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;GetByCategory&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;category)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository_Fixture&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;solution&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:270px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;TestFixture]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository_Fixture&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ISessionFactory&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;sessionFactory;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Configuration&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;configuration;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;TestFixtureSetUp]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;TestFixtureSetUp(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;configuration&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Configuration()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;configuration.Configure();&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;configuration.AddAssembly(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;typeof&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Product).Assembly);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;sessionFactory&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;configuration.BuildSessionFactory();&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;In&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fourth&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;line&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;TestFixtureSetUp&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;factory&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;This&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;an&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;expensive&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;process&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;should&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;thus&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;be&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;executed&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;only&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;once&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;That&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;reason&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;why&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;I&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;put&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;into&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;which&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;only&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;executed&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;once&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;during&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;cycle&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;To&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;keep&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;methods&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;side&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;effect&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;free&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;re-create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;schema&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;before&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;execution&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;each&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Thus&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;SetUp]&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SetupContext(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SchemaExport(_configuration).Execute&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;true&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;false&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;br /&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;And&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implement&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;instance&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Start&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;adding&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;called&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Repositories&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;your&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;project&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;folder&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Make&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;inherit&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;from&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;interface&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;IProductRepository&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:652px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;System&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;System.Collections.Generic&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution.Repositories&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;:&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;IProductRepository&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add(Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Update(Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Remove(Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;GetById(Guid&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;productId&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;GetByName&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;name&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ICollection&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;Product&amp;gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;GetByCategory&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;category&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;throw&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NotImplementedException()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;h6&gt;&lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Manipulating&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Data&lt;/span&gt;&lt;/b&gt;&lt;/h6&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;go&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;back&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository_Fixture&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implement&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;      &lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Test]&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Can_add_new_product(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;var&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Apple&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Fruits&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;IProductRepository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;repository.Add(product)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;br /&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;run&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fail&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;since&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;not&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;yet&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implemented&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Let&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;do&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;But&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;wait&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;little&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;helper&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;which&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;provides&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;us&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;objects&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;on&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;demand&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:523px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution.Domain&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate.Cfg&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;namespace&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;FirstSolution.Repositories&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernateHelper&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ISessionFactory&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;sessionFactory;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ISessionFactory&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SessionFactory&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;if&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;_sessionFactory&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;null&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                    &lt;span style="text-decoration: line-through; color: red;"&gt;var&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configuration&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Configuration()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                    &lt;span style="text-decoration: line-through; color: red;"&gt;configuration.Configure()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                    &lt;span style="text-decoration: line-through; color: red;"&gt;configuration.AddAssembly&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;typeof&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Product).Assembly);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                    &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;sessionFactory&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configuration.BuildSessionFactory()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;sessionFactory;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;static&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ISession&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;OpenSession(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;return&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SessionFactory.OpenSession()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;This&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;creates&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;factory&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;only&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;time&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;client&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;needs&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;define&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;follows&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add(Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ISession&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernateHelper.OpenSession()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ITransaction&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;transaction&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session.BeginTransaction()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;                    &lt;span style="text-decoration: line-through; color: red;"&gt;session.Save(product)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;br /&gt;                    &lt;span style="text-decoration: line-through; color: red;"&gt;transaction.Commit()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;br /&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;second&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;run&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;again&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fail&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;message&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/ShouldBeVirtual.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;That&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;because&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;default&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;configured&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;use&lt;/span&gt;&lt;b&gt;&amp;nbsp;&lt;a href="http://martinfowler.com/eaaCatalog/lazyLoad.html"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;lazy&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;load&lt;/span&gt;&lt;/a&gt;&lt;/b&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;all&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;entities&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;That&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;recommended&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;approach&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;I&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;warmly&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;recommend&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;not&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;change&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;maximum&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;flexibility&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;How&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;can&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;solve&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;issue&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;?&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;It&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;easy&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;just&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;make&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;all&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;properties&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;methods&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;domain&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;object(s&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;virtual&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Let&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;do&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt;&lt;br /&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;virtual&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Guid&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Id&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;virtual&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;virtual&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;string&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;virtual&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;bool&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Discontinued&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;set&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;    &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;run&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;again&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;It&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;should&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;succeed&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;get&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;output&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&lt;img src="/cfs-file.ashx/__key/CommunityServer.Wikis.Components.Files/howtonh/TestOutput.png" alt="" /&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Note&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;sql&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;spit&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;out&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;by&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;think&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;successfully&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;inserted&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;into&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;But&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;let&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;whether&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;really&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;so&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Let&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;extend&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;our&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:313px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Test]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Can_add_new_product(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;var&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Apple&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Fruits&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;IProductRepository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;repository.Add(product)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#008000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;use&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;try&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;load&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ISession&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;sessionFactory.OpenSession())&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;var&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fromDb&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session.Get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;Product&amp;gt;(product.Id);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="color:#008000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;was&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;successfully&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;inserted&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;Assert.IsNotNull(fromDb)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;Assert.AreNotSame(product&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fromDb)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;Assert.AreEqual(product.Name&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fromDb.Name)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;Assert.AreEqual(product.Category&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fromDb.Category)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Run&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;again&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Hopefully&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;succeed..&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;are&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ready&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implement&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;also&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;other&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;methods&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;For&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;testing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;would&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;rather&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;have&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;table&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;already&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;containing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;some&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;products&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Nothing&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;easier&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;than&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Just&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;CreateInitialData&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;class&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;as&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;follows&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:355px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;&lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;readonly&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;]&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;products&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                 &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Melon&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Fruits&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Pear&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Fruits&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Milk&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Beverages&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Coca&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Cola&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Beverages&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                     &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Pepsi&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Cola&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Category&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Beverages&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                 &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;private&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;CreateInitialData(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ISession&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;sessionFactory.OpenSession())&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ITransaction&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;transaction&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session.BeginTransaction()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                    &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;foreach&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;var&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;products)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                        &lt;span style="text-decoration: line-through; color: red;"&gt;session.Save(product)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                    &lt;span style="text-decoration: line-through; color: red;"&gt;transaction.Commit()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Call&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;from&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;SetupContext&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;after&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;create&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;schema&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;call&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;and&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;are&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;done&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Now&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;each&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;time&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;after&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;schema&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;created&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;database&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;populated&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;some&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;products&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Let&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;#39;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;s&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Update&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;with&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;following&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;height:269px;background-color:#f4f4f4;"&gt;
&lt;div style="border-style:none;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;[&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Test]&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Can_update_existing_product(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;var&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;products[0];&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;product.Name&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#006080;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;Yellow&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Pear&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;quot;&lt;/span&gt;&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;IProductRepository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;new&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;ProductRepository()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;repository.Update(product)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt; &lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="color:#008000;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;/&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;use&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;try&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;load&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ISession&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;_&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;sessionFactory.OpenSession())&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;var&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fromDb&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session.Get&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;&amp;lt;Product&amp;gt;(product.Id);&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;Assert.AreEqual(product.Name&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;,&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fromDb.Name)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:white;"&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;When&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;running&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;for&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;time&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;this&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;code&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;will&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fail&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;since&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Update&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;has&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;not&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;yet&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;been&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implemented&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Note&lt;/span&gt;&lt;/b&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;:&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;This&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;expected&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;behavior&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;since&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;in&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;TDD&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;first&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;time&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;you&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;run&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;a&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;test&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;it&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;should&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;always&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;fail&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;!&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Analogous&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;to&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Add&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;implement&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Update&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;repository&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;The&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;only&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;difference&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;is&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;that&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;we&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;call&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;update&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernate&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;object&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;instead&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;of&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;save&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;method&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;.&lt;/span&gt;&lt;/p&gt;
&lt;div&gt;
&lt;div style="border:1px solid gray;margin:20px 0px 10px;padding:4px;overflow:auto;font-size:8pt;width:97.5%;cursor:text;max-height:200px;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;
&lt;pre style="border-style:none;margin:0em;padding:0px;overflow:visible;font-size:8pt;width:100%;color:black;line-height:12pt;font-family:consolas,&amp;#39;Courier New&amp;#39;,courier,monospace;background-color:#f4f4f4;"&gt;        &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;public&lt;/span&gt;&lt;/span&gt; &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;void&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;Update(Product&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;product&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ISession&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;NHibernateHelper.OpenSession()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;            &lt;span style="color:#0000ff;"&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;using&lt;/span&gt;&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;(&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;ITransaction&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;transaction&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;=&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;session.BeginTransaction()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;)&lt;/span&gt;&lt;br /&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;{&lt;/span&gt;&lt;br /&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;session.Update(product)&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;br /&gt;                &lt;span style="text-decoration: line-through; color: red;"&gt;transaction.Commit()&lt;/span&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;;&lt;/span&gt;&lt;br /&gt;            &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;br /&gt;        &lt;span style="text-decoration: line-through; color: red;"&gt;}&lt;/span&gt;&lt;/pre&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;&lt;span style="text-decoration: line-through; color: red;"&gt;Run&lt;/span&gt; &lt;span style="text-decoration: line-through; color: red;"&gt;the&lt;/span&gt; &lt;span style="text-decoration: line-through; col