<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>Felice Pollano Blog - NHibernate</title>
    <link>http://www.felicepollano.com/</link>
    <description>The official Fatica Labs Blog!</description>
    <language>en-us</language>
    <copyright>Felice Pollano</copyright>
    <lastBuildDate>Fri, 03 Sep 2010 09:28:31 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 2.3.9074.18820</generator>
    <managingEditor>felice@felicepollano.com</managingEditor>
    <webMaster>felice@felicepollano.com</webMaster>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=663c8501-5793-4fa1-b672-c4ebad65b04b</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,663c8501-5793-4fa1-b672-c4ebad65b04b.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,663c8501-5793-4fa1-b672-c4ebad65b04b.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=663c8501-5793-4fa1-b672-c4ebad65b04b</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Meglio, più in generale, non funziona più l’intellisense per<strong> qualsiasi documento
XML</strong> per cui abbiamo uno ( o più.. ) <strong>XSD</strong>. Questo accade perchè
Visual Studio trova più sorgenti per lo schema dichiarato nell’ XML, nel caso <a href="http://nhforge.org" target="_blank">NHibernate</a> abbiamo
la seguente dichiarazione in testa:
</p>
        <pre class="csharpcode">
          <span class="kwrd">&lt;?</span>
          <span class="html">xml</span>
          <span class="attr">version</span>
          <span class="kwrd">="1.0"</span>?<span class="kwrd">&gt;</span><span class="kwrd">&lt;</span><span class="html">hibernate-mapping</span><span class="attr">xmlns</span><span class="kwrd">="urn:nhibernate-mapping-2.2"</span><span class="attr">assembly</span><span class="kwrd">="....."</span><span class="attr">namespace</span><span class="kwrd">="....."</span><span class="kwrd">&gt;</span></pre>
        <p>
          <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
Se abbiamo nella <strong>solution</strong>, o nella directory <strong>%Program Files%/Microsoft
Visual Studio XXX/Xml/Schemas</strong>  uno o più file che definiscono lo stesso
namespace, in questo caso
</p>
        <pre class="csharpcode">
          <span class="kwrd">&lt;</span>
          <span class="html">xs:schema</span>
          <span class="attr">targetNamespace</span>
          <span class="kwrd">="urn:nhibernate-mapping-2.2"</span>
          <span class="attr">xmlns:xs</span>
          <span class="kwrd">="http://www.w3.org/2001/XMLSchema"</span>
          <span class="attr">xmlns</span>
          <span class="kwrd">="urn:nhibernate-mapping-2.2"</span>
          <span class="attr">elementFormDefault</span>
          <span class="kwrd">="qualified"</span>
          <span class="attr">attributeFormDefault</span>
          <span class="kwrd">="unqualified"</span>
          <span class="kwrd">&gt;</span>
        </pre>
        <p>
          <span class="kwrd">
          </span>
        </p>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
Visual Studio trova un <strong>ambiguità</strong> per cui <strong>smette di fornire
l’intellisense</strong>. La situazione si può risolvere facilmente senza disperare:
</p>
        <p>
Basta cliccare sul documento XML da visual studio e dalla finestra proprietà editare
la voce <strong>Schemas</strong> come mostrato qui sotto:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/AiutoooononfunzionapilintellisensediNHib_A153/xmlschemas_2.png">
            <img style="border: 0px none; display: inline;" title="xmlschemas" alt="xmlschemas" src="http://www.felicepollano.com/public/WindowsLiveWriter/AiutoooononfunzionapilintellisensediNHib_A153/xmlschemas_thumb.png" width="342" border="0" height="288" />
          </a>
        </p>
        <p>
Così facendo si apre una finestra in cui è possibile abilitare/disabilitare gli schema
che visual studio intende usare:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/AiutoooononfunzionapilintellisensediNHib_A153/xmlschema2_2.png">
            <img style="border: 0px none; display: inline;" title="xmlschema2" alt="xmlschema2" src="http://www.felicepollano.com/public/WindowsLiveWriter/AiutoooononfunzionapilintellisensediNHib_A153/xmlschema2_thumb.png" width="434" border="0" height="486" />
          </a>
        </p>
        <p>
Deselezionando uno degli schemi ambigui tutto torna a funzionare. Ovviamente questo
funziona per qualsiasi ambiguità di schema, non solo per NHibernate.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=663c8501-5793-4fa1-b672-c4ebad65b04b" />
      </body>
      <title>Aiutoooo! Non funziona più l’intellisense di NHibernate</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,663c8501-5793-4fa1-b672-c4ebad65b04b.aspx</guid>
      <link>http://www.felicepollano.com/2010/09/03/AiutooooNonFunzionaPi%c3%b9LintellisenseDiNHibernate.aspx</link>
      <pubDate>Fri, 03 Sep 2010 09:28:31 GMT</pubDate>
      <description>&lt;p&gt;
Meglio, più in generale, non funziona più l’intellisense per&lt;strong&gt; qualsiasi documento
XML&lt;/strong&gt; per cui abbiamo uno ( o più.. ) &lt;strong&gt;XSD&lt;/strong&gt;. Questo accade perchè
Visual Studio trova più sorgenti per lo schema dichiarato nell’ XML, nel caso &lt;a href="http://nhforge.org" target="_blank"&gt;NHibernate&lt;/a&gt; abbiamo
la seguente dichiarazione in testa:
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt;?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;hibernate-mapping&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="urn:nhibernate-mapping-2.2"&lt;/span&gt; &lt;span class="attr"&gt;assembly&lt;/span&gt;&lt;span class="kwrd"&gt;="....."&lt;/span&gt; &lt;span class="attr"&gt;namespace&lt;/span&gt;&lt;span class="kwrd"&gt;="....."&lt;/span&gt; &lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
Se abbiamo nella &lt;strong&gt;solution&lt;/strong&gt;, o nella directory &lt;strong&gt;%Program Files%/Microsoft
Visual Studio XXX/Xml/Schemas&lt;/strong&gt;&amp;nbsp; uno o più file che definiscono lo stesso
namespace, in questo caso
&lt;/p&gt;
&lt;pre class="csharpcode"&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;xs:schema&lt;/span&gt; &lt;span class="attr"&gt;targetNamespace&lt;/span&gt;&lt;span class="kwrd"&gt;="urn:nhibernate-mapping-2.2"&lt;/span&gt; &lt;span class="attr"&gt;xmlns:xs&lt;/span&gt;&lt;span class="kwrd"&gt;="http://www.w3.org/2001/XMLSchema"&lt;/span&gt; &lt;span class="attr"&gt;xmlns&lt;/span&gt;&lt;span class="kwrd"&gt;="urn:nhibernate-mapping-2.2"&lt;/span&gt; &lt;span class="attr"&gt;elementFormDefault&lt;/span&gt;&lt;span class="kwrd"&gt;="qualified"&lt;/span&gt; &lt;span class="attr"&gt;attributeFormDefault&lt;/span&gt;&lt;span class="kwrd"&gt;="unqualified"&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;p&gt;
&lt;span class="kwrd"&gt;&lt;/span&gt;
&lt;/p&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
Visual Studio trova un &lt;strong&gt;ambiguità&lt;/strong&gt; per cui &lt;strong&gt;smette di fornire
l’intellisense&lt;/strong&gt;. La situazione si può risolvere facilmente senza disperare:
&lt;/p&gt;
&lt;p&gt;
Basta cliccare sul documento XML da visual studio e dalla finestra proprietà editare
la voce &lt;strong&gt;Schemas&lt;/strong&gt; come mostrato qui sotto:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/AiutoooononfunzionapilintellisensediNHib_A153/xmlschemas_2.png"&gt;&lt;img style="border: 0px none; display: inline;" title="xmlschemas" alt="xmlschemas" src="http://www.felicepollano.com/public/WindowsLiveWriter/AiutoooononfunzionapilintellisensediNHib_A153/xmlschemas_thumb.png" width="342" border="0" height="288"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Così facendo si apre una finestra in cui è possibile abilitare/disabilitare gli schema
che visual studio intende usare:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/AiutoooononfunzionapilintellisensediNHib_A153/xmlschema2_2.png"&gt;&lt;img style="border: 0px none; display: inline;" title="xmlschema2" alt="xmlschema2" src="http://www.felicepollano.com/public/WindowsLiveWriter/AiutoooononfunzionapilintellisensediNHib_A153/xmlschema2_thumb.png" width="434" border="0" height="486"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Deselezionando uno degli schemi ambigui tutto torna a funzionare. Ovviamente questo
funziona per qualsiasi ambiguità di schema, non solo per NHibernate.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=663c8501-5793-4fa1-b672-c4ebad65b04b" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,663c8501-5793-4fa1-b672-c4ebad65b04b.aspx</comments>
      <category>NHibernate</category>
      <category>Programmin</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=b497bd4a-5353-4921-8bca-f2a29a80b3ec</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,b497bd4a-5353-4921-8bca-f2a29a80b3ec.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,b497bd4a-5353-4921-8bca-f2a29a80b3ec.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=b497bd4a-5353-4921-8bca-f2a29a80b3ec</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <h5>continua da <a href="http://www.felicepollano.com/2010/08/28/NHibernatePartireDaZEROParte1CosaCiServe.aspx" target="_blank">Parte1:
Cosa ci serve</a></h5>
        <p align="justify">
In questa parte costruiamo un progetto con <a href="http://nhforge.org" target="_blank">NHibernate</a> che
ci consentirà di persistere una prima entità. In effetti la parte OR/M sarà tenuta
il più semplice possibile, niente reference o collezioni o componenti: l’obiettivo
è creare uno scheletro funzionante e <strong>testabile</strong>. Ovviamente tutto
quanto detto servirà da spunto, alcune cose potranno sembrare ovvie, altre meno, fate
come credete meglio, ma poichè questo è un corso “da zero” voglio soffermarmi su tutti
i punti.
</p>
        <p align="justify">
Decidiamo di mettere le entitità in una Class Library ( dll ). Questa è una scelta
che probabilmente sarà conveniente fare anche per una soluzione vera da mandare in
produzione. Creiamo quindi una nuova solution con Visual Studio. Distinguiamo il nome
della soluzione con NHFromScratch.All, ed aggiungiamo all interno un nuovo progetto
di tipo class library, che andiamo a chiamare NHFromScratch.Entities.
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t1_2.png">
            <img style="border-width: 0px; display: inline;" title="t1" alt="t1" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t1_thumb.png" width="442" border="0" height="263" />
          </a>
        </p>
        <p align="justify">
All’ interno della cartella radice della solution, creiamo una sottocartella “Lib”,
atta a contenere le dipendenze della soluzione ( NHibernate e non ), ad esempio in
aggiunta alle dipendenze di NH vedete la nunit.framework.dll, dipendenza che ci servirà
a breve quando vorremo testare le nostre entità.
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t2_2.png">
            <img style="border-width: 0px; display: inline;" title="t2" alt="t2" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t2_thumb.png" width="378" border="0" height="182" />
          </a>
        </p>
        <p>
Bene, il passo successivo è creare il mapping per la prima ed unica entità che vogliamo
gestire. Ci sono una moltitudine di strategie per creare un mapping per NH, quella
che presento qua è una soluzione “plain vanilla”, senza nessun fronzolo e a costo
zero: con la pratica ognuno sceglie il metodo che meglio crede, ma per imparare è
mia opinione che scrivere il file XML sia di aiuto. Aggiungiamo quindi una sottocartella
“Mapping” nella class library appena creata, e in questo folder creiamo un nuovo file
con il nome della entità ( Customer nel nostro caso ) con l’estensione <strong>.hbm.xml</strong>.
Se abbiamo abilitato l’intellisense, come fortemente consigliato nella <a href="http://www.felicepollano.com/2010/08/28/NHibernatePartireDaZEROParte1CosaCiServe.aspx" target="_blank">parte
1</a> l’unico tag che dobbiamo ricordare a memoria è <strong>&lt;hibernate-mapping&gt;,</strong> tutti
gli altri saranno esposti via intellisense dopo che il namespace sarà correttamente
specificato, come mostrato qui sotto:
</p>
        <p>
        </p>
        <p>
 <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t4_2.png"><img style="border-width: 0px; display: inline;" title="t4" alt="t4" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t4_thumb.png" width="651" border="0" height="340" /></a></p>
        <p>
        </p>
        <p align="justify">
Cosa importantissima da ricordare, ricordiamo di impostare <strong>“Embedded Resource”</strong> come
build action sul file di mapping, altrimenti… la configurazione di NHibernate non
funzionerà. Ad essere precisi questo si potrebbe evitare, ma per farlo dovremmo distribuire
i file di mapping insieme all’applicazione, ed è un’opzione che francamente non mi
piace e nemmeno ho mai visto praticare.
</p>
        <p align="justify">
Fatto questo non rimane che scrivere difatto il mapping. In questo primo test useremo
solo tre elementi di mapping: <strong>class,key</strong> e <strong>property</strong>,
praticamente il minimo indispensabile per avere un entità al lavoro. Approfondiremo
i vari aspetti nelle prossime parti.
</p>
        <div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper">
          <div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet">
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum1"> 1:</span>
              <span style="color: rgb(0, 0, 255);">&lt;?</span>
              <span style="color: rgb(128, 0, 0);">xml</span>
              <span style="color: rgb(255, 0, 0);">version</span>
              <span style="color: rgb(0, 0, 255);">="1.0"</span>
              <span style="color: rgb(255, 0, 0);">encoding</span>
              <span style="color: rgb(0, 0, 255);">="utf-8"</span> ?<span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum2"> 2:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">hibernate-mapping</span>
              <span style="color: rgb(255, 0, 0);">xmlns</span>
              <span style="color: rgb(0, 0, 255);">="urn:nhibernate-mapping-2.2"</span>
              <span style="color: rgb(255, 0, 0);">namespace</span>
              <span style="color: rgb(0, 0, 255);">="NHFromScratch.Entities"</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum3"> 3:</span>
              <span style="color: rgb(255, 0, 0);">assembly</span>
              <span style="color: rgb(0, 0, 255);">="NHFromScratch.Entities"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum4"> 4:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">class</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="Customer"</span>
              <span style="color: rgb(255, 0, 0);">table</span>
              <span style="color: rgb(0, 0, 255);">="Customers"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum5"> 5:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">id</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="Id"</span>
              <span style="color: rgb(255, 0, 0);">type</span>
              <span style="color: rgb(0, 0, 255);">="Int32"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum6"> 6:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">generator</span>
              <span style="color: rgb(255, 0, 0);">class</span>
              <span style="color: rgb(0, 0, 255);">="native"</span>
              <span style="color: rgb(0, 0, 255);">/&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum7"> 7:</span>
              <span style="color: rgb(0, 0, 255);">&lt;/</span>
              <span style="color: rgb(128, 0, 0);">id</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum8"> 8:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="Name"</span>
              <span style="color: rgb(255, 0, 0);">type</span>
              <span style="color: rgb(0, 0, 255);">="String"</span>
              <span style="color: rgb(255, 0, 0);">not-null</span>
              <span style="color: rgb(0, 0, 255);">="true"</span>
              <span style="color: rgb(0, 0, 255);">/&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum9"> 9:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="AddressLine1"</span>
              <span style="color: rgb(255, 0, 0);">type</span>
              <span style="color: rgb(0, 0, 255);">="String"</span>
              <span style="color: rgb(255, 0, 0);">not-null</span>
              <span style="color: rgb(0, 0, 255);">="true"</span>
              <span style="color: rgb(0, 0, 255);">/&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum10"> 10:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="AddressLine2"</span>
              <span style="color: rgb(255, 0, 0);">type</span>
              <span style="color: rgb(0, 0, 255);">="String"</span>
              <span style="color: rgb(0, 0, 255);">/&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum11"> 11:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="City"</span>
              <span style="color: rgb(255, 0, 0);">type</span>
              <span style="color: rgb(0, 0, 255);">="String"</span>
              <span style="color: rgb(255, 0, 0);">not-null</span>
              <span style="color: rgb(0, 0, 255);">="true"</span>
              <span style="color: rgb(0, 0, 255);">/&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum12"> 12:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="ZipCode"</span>
              <span style="color: rgb(255, 0, 0);">type</span>
              <span style="color: rgb(0, 0, 255);">="String"</span>
              <span style="color: rgb(255, 0, 0);">not-null</span>
              <span style="color: rgb(0, 0, 255);">="true"</span>
              <span style="color: rgb(0, 0, 255);">/&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum13"> 13:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="Active"</span>
              <span style="color: rgb(255, 0, 0);">type</span>
              <span style="color: rgb(0, 0, 255);">="Boolean"</span>
              <span style="color: rgb(255, 0, 0);">not-null</span>
              <span style="color: rgb(0, 0, 255);">="true"</span>
              <span style="color: rgb(0, 0, 255);">/&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum14"> 14:</span>
              <span style="color: rgb(0, 0, 255);">&lt;/</span>
              <span style="color: rgb(128, 0, 0);">class</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum15"> 15:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum16"> 16:</span>
              <span style="color: rgb(0, 0, 255);">&lt;/</span>
              <span style="color: rgb(128, 0, 0);">hibernate-mapping</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum17"> 17:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum18"> 18:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum19"> 19:</span>  </pre>
            <!--CRLF-->
          </div>
        </div>
        <p align="justify">
Facciamo tuttavia due parole per dire a grandi linee cosa contiene il mapping della
entità Customer. Innanzitutto è specificato il namespace e l’assembly che contiene
l’entità mappata. Questo non è obbligatorio, ma ci consente di scrivere in maniera
più leggibile il nome della classe più avanti. Il tag class indica appunto la classe
che intendiamo utilizzare come entity. Ricordiamo che spesso non esiste un rapporto
1:1 tra tabelle ed entità, ms in questo semplice esempio così accadrà. Il tag class
ci permette di definire il nome della classe, e a quale tabella è associata su DB.
Il tag più sotto &lt;id&gt; è necessario: NHibernate vuole sapere come il database
“distingue” le entità. Ci sono svariati modi per fare questo, e ll modo viene scelto
dal sotto-tag generator: in questo esempio abbiamo specificato un generator “native”,
che significa id univoco assegnato dal DB ( identity, auto-incrementale ) comunque
esso si chiami nel DB target. Successivamente vengono le proprietà, con i loro bei
nomi e tipi dato. Noterete che non ho specificato nessun nome per la corrispondente
colonna sul DB: semplicemente se  il nome è uguale nessuno ci obbliga a farlo,
non ripetiamo noi stessi. Anzi, diciamo anche che il tipo sarebbe un surplus se scrivessimo
a mano la classe sottostante: NHibernate usa molto inferire le informazioni ovunque
sia possibile. Noi però la classe non abbiamo voglia di farla a mano, per cui ci serviamo
di <a href="hhttp://nhforge.org/media/p/546.aspx" target="_blank">hbm2net</a> ( vedi
la <a href="http://www.felicepollano.com/2010/08/28/NHibernatePartireDaZEROParte1CosaCiServe.aspx" target="_blank">parte
1</a> ). Per scatenare questo tool, usiamo un pre build step di Visual Studio, come
quello qui sotto:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t6_2.png">
            <img style="border-width: 0px; display: inline;" title="t6" alt="t6" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t6_thumb.png" width="413" border="0" height="231" />
          </a>
        </p>
        <p>
        </p>
        <p>
in pratica diciamo ad hbm2net di lavorare su tutti i file .hbm.xml che trova nella
sottocartella mapping della solution, di mettere gli output ( ovvero le classi ) nella
cartella del progetto. Sebbene hbm2net sia un editor template based che può generare
un po’ qualsiasi artefatto partendo dall hbm, senza parametri si limita a generare
le classi corrispondenti al mapping. Lanciando la build nell’output dovreste vedere
il progress anche di hbm2net:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t7_2.png">
            <img style="border-width: 0px; display: inline;" title="t7" alt="t7" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t7_thumb.png" width="625" border="0" height="154" />
          </a>
        </p>
        <p>
Finita la build, vi trovate il file autogenerato per la entity su file system. Aggiungetelo
al progetto. 
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t8_2.png">
            <img style="border-width: 0px; display: inline;" title="t8" alt="t8" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t8_thumb.png" width="523" border="0" height="89" />
          </a>
        </p>
        <p>
        </p>
        <p align="justify">
Date un’occhiata alla classe autogenerata, date un occhiata anche al mapping: se avete
provato qualche altro tool per NH noterete che il lavoro fatto finora sembra molto
semplificato. Stiamo scrivendo solo lo stretto indispensabile, quello che non ci serve
lo lasciamo assolutamente da parte, perchè questo è <strong>NHibernate da ZERO</strong>.
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t9_2.png">
            <img style="border-width: 0px; display: inline;" title="t9" alt="t9" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t9_thumb.png" width="199" border="0" height="244" />
          </a>
        </p>
        <p>
Bene, per completare la solution aggiungiamo la reference ad NHibernate: <strong>NHibernate
e Iesi.Collection</strong> sono gli unici assembly che dobbiamo referenziare a tempo
di build. 
</p>
        <p>
E’ finalmente l’ora di andare in test. Aggiungiamo alla solution un progetto di tipo
Class Library, in cui inseriremo gli unit test.
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t10_2.png">
            <img style="border-width: 0px; display: inline;" title="t10" alt="t10" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t10_thumb.png" width="440" border="0" height="235" />
          </a>
        </p>
        <p>
La solution di test, in modo simile ad un progetto che deve andare in produzione,
necessita delle reference non statiche di NHibernate. Noi le abbiamo nella cartella
Lib della solution, dobbiamo spostarli a fianco della dll di produzione. Possiamo
scegliere di farlo con un post-build step, come illustrato qui sotto.
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t11_2.png">
            <img style="border-width: 0px; display: inline;" title="t11" alt="t11" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t11_thumb.png" width="381" border="0" height="213" />
          </a>
        </p>
        <p align="justify">
Anche le reference di questo progetto sono un po’ più impegnative: ci serve Iesi.Collection
&amp; NHibernate come al solito, ma anche il nostro assembly con le entità, log4net
per il logging, ed in più, ovvviamente, nunit.framework, va da sè.
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t12_2.png">
            <img style="border-width: 0px; display: inline;" title="t12" alt="t12" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t12_thumb.png" width="244" border="0" height="238" />
          </a>
        </p>
        <p align="justify">
A me personalmente piace la barra verde di NUnit, per cui testiamo il progetto con
NUnit, mettendo NUnit.exe come “start external program”.
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t13_2.png">
            <img style="border-width: 0px; display: inline;" title="t13" alt="t13" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t13_thumb.png" width="474" border="0" height="143" />
          </a>
        </p>
        <p align="justify">
A questo punto creiamo il nostro unit test, con lo scopo di configurare NH, un po’
di log, e vedere se riusciamo a creare il Database. Sì, in questo tutorial il database
non lo facciamo a mano, perchè anche se questo è NHibernate da ZERO, vogliamo scrivere
il meno codice possibile.
</p>
        <p align="justify">
Il codice dello unit test è qui di seguito:
</p>
        <div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; height: 294px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper">
          <div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet">
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum1"> 1:</span>
              <span style="color: rgb(0, 0, 255);">namespace</span> NHFromScratch.Tests</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum2"> 2:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum3"> 3:</span> [TestFixture]</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum4"> 4:</span>
              <span style="color: rgb(0, 0, 255);">public</span>
              <span style="color: rgb(0, 0, 255);">class</span> TestCustomer</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum5"> 5:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum6"> 6:</span>
              <span style="color: rgb(0, 0, 255);">static</span> TestCustomer()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum7"> 7:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum8"> 8:</span> ConfigureLogForNet();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum9"> 9:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum10"> 10:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum11"> 11:</span> ISessionFactory
sessionFactory;</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum12"> 12:</span> [SetUp]</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum13"> 13:</span>
              <span style="color: rgb(0, 0, 255);">public</span>
              <span style="color: rgb(0, 0, 255);">void</span> Setup()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum14"> 14:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum15"> 15:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum16"> 16:</span> CreateSessionFactory();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum17"> 17:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum18"> 18:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum19"> 19:</span> [Test]</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum20"> 20:</span>
              <span style="color: rgb(0, 0, 255);">public</span>
              <span style="color: rgb(0, 0, 255);">void</span> CanCreatedatabse()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum21"> 21:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum22"> 22:</span> SchemaExport
export = <span style="color: rgb(0, 0, 255);">new</span> SchemaExport(CreateConfiguration());</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum23"> 23:</span> export.Execute(<span style="color: rgb(0, 0, 255);">true</span>, <span style="color: rgb(0, 0, 255);">true</span>, <span style="color: rgb(0, 0, 255);">false</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum24"> 24:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum25"> 25:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum26"> 26:</span> [Test]</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum27"> 27:</span>
              <span style="color: rgb(0, 0, 255);">public</span>
              <span style="color: rgb(0, 0, 255);">void</span> CanPersistCustomer()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum28"> 28:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum29"> 29:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
SAVE A CUSTOMER ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum30"> 30:</span>
              <span style="color: rgb(0, 128, 0);">//save
a customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum31"> 31:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum32"> 32:</span>
              <span style="color: rgb(0, 0, 255);">using</span>(var
transaction = session.BeginTransaction())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum33"> 33:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum34"> 34:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum35"> 35:</span> Customer
c = <span style="color: rgb(0, 0, 255);">new</span> Customer()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum36"> 36:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum37"> 37:</span> Active
= <span style="color: rgb(0, 0, 255);">true</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum38"> 38:</span> ,</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum39"> 39:</span> AddressLine1
= <span style="color: rgb(0, 96, 128);">"xxxx"</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum40"> 40:</span> ,</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum41"> 41:</span> City
= <span style="color: rgb(0, 96, 128);">"Cuneo"</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum42"> 42:</span> ,</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum43"> 43:</span> Name
= <span style="color: rgb(0, 96, 128);">"Bill Gates"</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum44"> 44:</span> ,</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum45"> 45:</span> ZipCode
= <span style="color: rgb(0, 96, 128);">"12060"</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum46"> 46:</span> };</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum47"> 47:</span> session.Save(c);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum48"> 48:</span> transaction.Commit();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum49"> 49:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum50"> 50:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
RETRIEVE A CUSTOMER ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum51"> 51:</span>
              <span style="color: rgb(0, 128, 0);">//retrieve
a customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum52"> 52:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum53"> 53:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum54"> 54:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum55"> 55:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum56"> 56:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum57"> 57:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum58"> 58:</span> .UniqueResult();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum59"> 59:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum60"> 60:</span> Assert.NotNull(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum61"> 61:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum62"> 62:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum63"> 63:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
MODIFY A CUSTOMER ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum64"> 64:</span>
              <span style="color: rgb(0, 128, 0);">//modify
a customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum65"> 65:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum66"> 66:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
transaction = session.BeginTransaction())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum67"> 67:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum68"> 68:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum69"> 69:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum70"> 70:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum71"> 71:</span> .UniqueResult&lt;Customer&gt;();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum72"> 72:</span> customer.ZipCode
= <span style="color: rgb(0, 96, 128);">"0000"</span>;</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum73"> 73:</span> Assert.NotNull(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum74"> 74:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum75"> 75:</span> transaction.Commit();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum76"> 76:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum77"> 77:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum78"> 78:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum79"> 79:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
VERIFY CUSTOMER IS MODIFIED ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum80"> 80:</span>
              <span style="color: rgb(0, 128, 0);">//verify
mod</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum81"> 81:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum82"> 82:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum83"> 83:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum84"> 84:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum85"> 85:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum86"> 86:</span> .UniqueResult&lt;Customer&gt;();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum87"> 87:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum88"> 88:</span> Assert.NotNull(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum89"> 89:</span> Assert.AreEqual(<span style="color: rgb(0, 96, 128);">"0000"</span>,
customer.ZipCode);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum90"> 90:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum91"> 91:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum92"> 92:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum93"> 93:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
DELETE A CUSTOMER ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum94"> 94:</span>
              <span style="color: rgb(0, 128, 0);">//delete
a customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum95"> 95:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum96"> 96:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
transaction = session.BeginTransaction())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum97"> 97:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum98"> 98:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum99"> 99:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum100"> 100:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum101"> 101:</span> .UniqueResult();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum102"> 102:</span> session.Delete(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum103"> 103:</span> transaction.Commit();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum104"> 104:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum105"> 105:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
VERIFY CUSTOMER IS DELETED ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum106"> 106:</span>
              <span style="color: rgb(0, 128, 0);">//verify
delete</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum107"> 107:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum108"> 108:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum109"> 109:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum110"> 110:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum111"> 111:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum112"> 112:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum113"> 113:</span> .UniqueResult();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum114"> 114:</span> Assert.IsNull(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum115"> 115:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum116"> 116:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum117"> 117:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum118"> 118:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum119"> 119:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum120"> 120:</span>
              <span style="color: rgb(0, 0, 255);">private</span>
              <span style="color: rgb(0, 0, 255);">static</span>
              <span style="color: rgb(0, 0, 255);">void</span> ConfigureLogForNet()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum121"> 121:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum122"> 122:</span> TraceAppender
app = <span style="color: rgb(0, 0, 255);">new</span> TraceAppender();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum123"> 123:</span> app.Layout
= <span style="color: rgb(0, 0, 255);">new</span> SimpleLayout();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum124"> 124:</span>
              <span style="color: rgb(0, 128, 0);">//BasicConfigurator.Configure(
app);</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum125"> 125:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum126"> 126:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum127"> 127:</span>
              <span style="color: rgb(0, 0, 255);">private</span>
              <span style="color: rgb(0, 0, 255);">void</span> CreateSessionFactory()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum128"> 128:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum129"> 129:</span> Configuration
cfg = CreateConfiguration();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum130"> 130:</span> sessionFactory
= cfg.BuildSessionFactory();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum131"> 131:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum132"> 132:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum133"> 133:</span>
              <span style="color: rgb(0, 0, 255);">private</span>
              <span style="color: rgb(0, 0, 255);">static</span> Configuration
CreateConfiguration()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum134"> 134:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum135"> 135:</span> Configuration
cfg = <span style="color: rgb(0, 0, 255);">new</span> Configuration();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum136"> 136:</span> cfg.Configure();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum137"> 137:</span>
              <span style="color: rgb(0, 128, 0);">//
implicitamente carichiamo tutti i mapping che si trovano nell'assembly che</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum138"> 138:</span>
              <span style="color: rgb(0, 128, 0);">//
contiene customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum139"> 139:</span> cfg.AddAssembly(<span style="color: rgb(0, 0, 255);">typeof</span>(Customer).Assembly);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum140"> 140:</span>
              <span style="color: rgb(0, 0, 255);">return</span> cfg;</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum141"> 141:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum142"> 142:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum143"> 143:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum144"> 144:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum145"> 145:</span> }</pre>
            <!--CRLF-->
          </div>
        </div>
        <p align="justify">
Fatto questo lanciamo il test “CanCreateDatabase” e, come probabilmente sospettiamo,
andiamo in rosso con il logger che dice qualcosa come qua sotto:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t14_2.png">
            <img style="border-width: 0px; display: inline;" title="t14" alt="t14" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t14_thumb.png" width="621" border="0" height="266" />
          </a>
        </p>
        <p>
In effetti, ci siamo “dimenticati” di configurare NHibernate, per cui a che DB potrebbe
mai puntare ? Come vedete avere il log abilitato lascia pochi dubbi rispetto a quale
sia l’errore. Tra l’altro manca persino il database…
</p>
        <p>
Quindi creiamo prima un database vuoto, non serve fare nessuna tabella, lasciamo che
sia NHibernate a fare il lavoro sporco
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t16_2.png">
            <img style="border-width: 0px; display: inline;" title="t16" alt="t16" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t16_thumb.png" width="345" border="0" height="358" />
          </a>
        </p>
        <p>
 
</p>
        <p align="justify">
Nell’esempio ho creato un database con nome NHFROMSCRATCH sull’SQLEXPRESS locale.
Poi tornando alla  , quando si vedeva il contenuto dello ZIP, rocorderete la
cartella <strong>Configuration_Templates</strong>: in questa cartella ci sono appunto
dei template di configurazione, in cui basta sostituire un po’ di cose per essere
pronti a lavorare con il db scelto:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t15_4.png">
            <img style="border-width: 0px; display: inline;" title="t15" alt="t15" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t15_thumb_1.png" width="244" border="0" height="228" />
          </a>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
Nel nostro caso scegliamo MSSQL. Il contenuto del file, dopo le modifiche del caso
è questo:
</p>
        <div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper">
          <div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet">
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum1"> 1:</span>
              <span style="color: rgb(0, 0, 255);">&lt;?</span>
              <span style="color: rgb(128, 0, 0);">xml</span>
              <span style="color: rgb(255, 0, 0);">version</span>
              <span style="color: rgb(0, 0, 255);">="1.0"</span>
              <span style="color: rgb(255, 0, 0);">encoding</span>
              <span style="color: rgb(0, 0, 255);">="utf-8"</span> ?<span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum2"> 2:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum3"> 3:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum4"> 4:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">hibernate-configuration</span>
              <span style="color: rgb(255, 0, 0);">xmlns</span>
              <span style="color: rgb(0, 0, 255);">="urn:nhibernate-configuration-2.2"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum5"> 5:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">session-factory</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="NHibernate.Test"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum6"> 6:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="connection.driver_class"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>NHibernate.Driver.SqlClientDriver<span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum7"> 7:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="connection.connection_string"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>Server=.\SQLEXPRESS;initial
catalog=NHFROMSCRATCH;Integrated Security=SSPI<span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum8"> 8:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="adonet.batch_size"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>10<span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum9"> 9:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="show_sql"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>true<span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum10"> 10:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="dialect"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>NHibernate.Dialect.MsSql2005Dialect<span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum11"> 11:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="use_outer_join"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>true<span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum12"> 12:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="command_timeout"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>60<span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum13"> 13:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="query.substitutions"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>true
1, false 0, yes 'Y', no 'N'<span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum14"> 14:</span>
              <span style="color: rgb(0, 0, 255);">&lt;</span>
              <span style="color: rgb(128, 0, 0);">property</span>
              <span style="color: rgb(255, 0, 0);">name</span>
              <span style="color: rgb(0, 0, 255);">="proxyfactory.factory_class"</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu<span style="color: rgb(0, 0, 255);">&lt;/</span><span style="color: rgb(128, 0, 0);">property</span><span style="color: rgb(0, 0, 255);">&gt;</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum15"> 15:</span>
              <span style="color: rgb(0, 0, 255);">&lt;/</span>
              <span style="color: rgb(128, 0, 0);">session-factory</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum16"> 16:</span>
              <span style="color: rgb(0, 0, 255);">&lt;/</span>
              <span style="color: rgb(128, 0, 0);">hibernate-configuration</span>
              <span style="color: rgb(0, 0, 255);">&gt;</span>
            </pre>
            <!--CRLF-->
          </div>
        </div>
        <p>
 
</p>
        <p align="justify">
Come si vede, le modifiche sostanziali sono nella proprietà connection string, e in
show_sql, che ho messo a true, per visualizzare le query mentre NH le esegue: un trucco
che ci permetterà non tanto di vedere <strong>come</strong> NHibernate fa le query,
ma piuttosto <strong>quante</strong> ne fa, per fare performance tuning. Questa sessione
di configurazione potrà essere messa nel file di configurazione dell’applicazione,
o vicino al file binario che la usa in un file di nome <strong>hibernate.cfg.xml</strong>,
soluzione scelta nell’esempio.
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t17_2.png">
            <img style="border-width: 0px; display: inline;" title="t17" alt="t17" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t17_thumb.png" width="248" border="0" height="348" />
          </a>
        </p>
        <p>
Ricordiamoci che, dopo aver inserito il file hibernate.cfg.xml nel progetto, dobbiamo
impostare il flag “copy if newer” cosicchè verrà copiato automaticamente nella cartella
di uscita.
</p>
        <p>
vediamo ora come è fatto il test “<strong>CanCreateDatabase</strong>”:
</p>
        <div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper">
          <div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet">
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum1"> 1:</span> [Test]</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum2"> 2:</span>
              <span style="color: rgb(0, 0, 255);">public</span>
              <span style="color: rgb(0, 0, 255);">void</span> CanCreatedatabse()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum3"> 3:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum4"> 4:</span> SchemaExport
export = <span style="color: rgb(0, 0, 255);">new</span> SchemaExport(CreateConfiguration());</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum5"> 5:</span> export.Execute(<span style="color: rgb(0, 0, 255);">true</span>, <span style="color: rgb(0, 0, 255);">true</span>, <span style="color: rgb(0, 0, 255);">false</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum6"> 6:</span> }</pre>
            <!--CRLF-->
          </div>
          <p>
 
</p>
        </div>
        <p>
Usiamo la classe di Helper SchemaExport: questa classe, partendo dalla Configurazione
corrente, si occupa di effettuare la <strong>creazione dello schema del database</strong>.
Ora lanciando il test questi si comporta meglio, e nella porzione console è possibile 
vedere la DDL che è stata inviata al database.
</p>
        <p>
 
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t18_2.png">
            <img style="border: 0px none; display: block; float: none; margin-left: auto; margin-right: auto;" title="t18" alt="t18" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t18_thumb.png" width="796" border="0" height="452" />
          </a>
        </p>
        <p>
Tramite il flag della funzione Export, è possibile sottometere lo script al sistema
database sottostante, nel nostro caso otterremo su DB l’unica tabella del nostro minuscolo
modello di test:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t19_2.png">
            <img style="border: 0px none; display: block; float: none; margin-left: auto; margin-right: auto;" title="t19" alt="t19" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t19_thumb.png" width="244" border="0" height="203" />
          </a>
        </p>
        <p>
Quindi facciamo un breve recap fino a questo punto: con un solo file ( il mapping
appunto ) abbiamo creato un database e il codice c#. Tutto questo grazie ad hbm2net,
che è un code generator open source recuoperabile da <a href="https://sourceforge.net/projects/nhcontrib/" target="_blank">NHContrib</a>.
Con un po’ di pazienza è possibil emodificare e/o scrivere template aggiuntivi per
hbm2net per geenrare altri tipidi artefacts, ad esempio DTO o altro, ma questo sarà
visto più avanti. In pratica possiamo vedere hbm2net come un generatore di codice
programmabile, che di default produce il codice delle entity partendo dai file hbm.
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t18b_2.png">
            <img style="border: 0px none; display: block; float: none; margin-left: auto; margin-right: auto;" title="t18b" alt="t18b" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t18b_thumb.png" width="351" border="0" height="264" />
          </a>
        </p>
        <p>
 
</p>
        <p>
        </p>
        <p>
Ora possiamo scrivere il codice di prova per il modello. Mettendo a “true” il valore
di show_sql nella configurazione, NH manda in standard output le query, per cui in
debug è possibile ispezionare cosa succede dietro le quinte. Il nostro semplice unit
test crea/modifica/cancella una semplice istanza della entità customer, eco il codice
dello unit test che fa tutto questo:
</p>
        <div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper">
          <div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet">
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum1"> 1:</span>
              <span style="color: rgb(0, 0, 255);">namespace</span> NHFromScratch.Tests</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum2"> 2:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum3"> 3:</span> [TestFixture]</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum4"> 4:</span>
              <span style="color: rgb(0, 0, 255);">public</span>
              <span style="color: rgb(0, 0, 255);">class</span> TestCustomer</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum5"> 5:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum6"> 6:</span>
              <span style="color: rgb(0, 0, 255);">static</span> TestCustomer()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum7"> 7:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum8"> 8:</span> ConfigureLogForNet();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum9"> 9:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum10"> 10:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum11"> 11:</span> ISessionFactory
sessionFactory;</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum12"> 12:</span> [SetUp]</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum13"> 13:</span>
              <span style="color: rgb(0, 0, 255);">public</span>
              <span style="color: rgb(0, 0, 255);">void</span> Setup()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum14"> 14:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum15"> 15:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum16"> 16:</span> CreateSessionFactory();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum17"> 17:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum18"> 18:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum19"> 19:</span> [Test]</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum20"> 20:</span>
              <span style="color: rgb(0, 0, 255);">public</span>
              <span style="color: rgb(0, 0, 255);">void</span> CanCreatedatabse()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum21"> 21:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum22"> 22:</span> SchemaExport
export = <span style="color: rgb(0, 0, 255);">new</span> SchemaExport(CreateConfiguration());</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum23"> 23:</span> export.Execute(<span style="color: rgb(0, 0, 255);">true</span>, <span style="color: rgb(0, 0, 255);">true</span>, <span style="color: rgb(0, 0, 255);">false</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum24"> 24:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum25"> 25:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum26"> 26:</span> [Test]</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum27"> 27:</span>
              <span style="color: rgb(0, 0, 255);">public</span>
              <span style="color: rgb(0, 0, 255);">void</span> CanPersistCustomer()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum28"> 28:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum29"> 29:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
SAVE A CUSTOMER ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum30"> 30:</span>
              <span style="color: rgb(0, 128, 0);">//save
a customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum31"> 31:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum32"> 32:</span>
              <span style="color: rgb(0, 0, 255);">using</span>(var
transaction = session.BeginTransaction())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum33"> 33:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum34"> 34:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum35"> 35:</span> Customer
c = <span style="color: rgb(0, 0, 255);">new</span> Customer()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum36"> 36:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum37"> 37:</span> Active
= <span style="color: rgb(0, 0, 255);">true</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum38"> 38:</span> ,</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum39"> 39:</span> AddressLine1
= <span style="color: rgb(0, 96, 128);">"xxxx"</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum40"> 40:</span> ,</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum41"> 41:</span> City
= <span style="color: rgb(0, 96, 128);">"Cuneo"</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum42"> 42:</span> ,</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum43"> 43:</span> Name
= <span style="color: rgb(0, 96, 128);">"Bill Gates"</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum44"> 44:</span> ,</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum45"> 45:</span> ZipCode
= <span style="color: rgb(0, 96, 128);">"12060"</span></pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum46"> 46:</span> };</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum47"> 47:</span> session.Save(c);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum48"> 48:</span> transaction.Commit();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum49"> 49:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum50"> 50:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
RETRIEVE A CUSTOMER ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum51"> 51:</span>
              <span style="color: rgb(0, 128, 0);">//retrieve
a customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum52"> 52:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum53"> 53:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum54"> 54:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum55"> 55:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum56"> 56:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum57"> 57:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum58"> 58:</span> .UniqueResult();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum59"> 59:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum60"> 60:</span> Assert.NotNull(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum61"> 61:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum62"> 62:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum63"> 63:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
MODIFY A CUSTOMER ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum64"> 64:</span>
              <span style="color: rgb(0, 128, 0);">//modify
a customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum65"> 65:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum66"> 66:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
transaction = session.BeginTransaction())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum67"> 67:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum68"> 68:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum69"> 69:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum70"> 70:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum71"> 71:</span> .UniqueResult&lt;Customer&gt;();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum72"> 72:</span> customer.ZipCode
= <span style="color: rgb(0, 96, 128);">"0000"</span>;</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum73"> 73:</span> Assert.NotNull(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum74"> 74:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum75"> 75:</span> transaction.Commit();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum76"> 76:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum77"> 77:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum78"> 78:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum79"> 79:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
VERIFY CUSTOMER IS MODIFIED ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum80"> 80:</span>
              <span style="color: rgb(0, 128, 0);">//verify
mod</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum81"> 81:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum82"> 82:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum83"> 83:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum84"> 84:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum85"> 85:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum86"> 86:</span> .UniqueResult&lt;Customer&gt;();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum87"> 87:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum88"> 88:</span> Assert.NotNull(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum89"> 89:</span> Assert.AreEqual(<span style="color: rgb(0, 96, 128);">"0000"</span>,
customer.ZipCode);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum90"> 90:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum91"> 91:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum92"> 92:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum93"> 93:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
DELETE A CUSTOMER ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum94"> 94:</span>
              <span style="color: rgb(0, 128, 0);">//delete
a customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum95"> 95:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum96"> 96:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
transaction = session.BeginTransaction())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum97"> 97:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum98"> 98:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum99"> 99:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum100"> 100:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum101"> 101:</span> .UniqueResult();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum102"> 102:</span> session.Delete(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum103"> 103:</span> transaction.Commit();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum104"> 104:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum105"> 105:</span> Console.WriteLine(<span style="color: rgb(0, 96, 128);">"\n******
VERIFY CUSTOMER IS DELETED ********"</span>);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum106"> 106:</span>
              <span style="color: rgb(0, 128, 0);">//verify
delete</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum107"> 107:</span>
              <span style="color: rgb(0, 0, 255);">using</span> (var
session = sessionFactory.OpenSession())</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum108"> 108:</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum109"> 109:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum110"> 110:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum111"> 111:</span> var
customer = session.CreateCriteria&lt;Customer&gt;()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum112"> 112:</span> .Add(Expression.Eq(<span style="color: rgb(0, 96, 128);">"Name"</span>, <span style="color: rgb(0, 96, 128);">"Bill
Gates"</span>))</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum113"> 113:</span> .UniqueResult();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum114"> 114:</span> Assert.IsNull(customer);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum115"> 115:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum116"> 116:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum117"> 117:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum118"> 118:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum119"> 119:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum120"> 120:</span>
              <span style="color: rgb(0, 0, 255);">private</span>
              <span style="color: rgb(0, 0, 255);">static</span>
              <span style="color: rgb(0, 0, 255);">void</span> ConfigureLogForNet()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum121"> 121:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum122"> 122:</span> TraceAppender
app = <span style="color: rgb(0, 0, 255);">new</span> TraceAppender();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum123"> 123:</span> app.Layout
= <span style="color: rgb(0, 0, 255);">new</span> SimpleLayout();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum124"> 124:</span>
              <span style="color: rgb(0, 128, 0);">//BasicConfigurator.Configure(
app);</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum125"> 125:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum126"> 126:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum127"> 127:</span>
              <span style="color: rgb(0, 0, 255);">private</span>
              <span style="color: rgb(0, 0, 255);">void</span> CreateSessionFactory()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum128"> 128:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum129"> 129:</span> Configuration
cfg = CreateConfiguration();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum130"> 130:</span> sessionFactory
= cfg.BuildSessionFactory();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum131"> 131:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum132"> 132:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum133"> 133:</span>
              <span style="color: rgb(0, 0, 255);">private</span>
              <span style="color: rgb(0, 0, 255);">static</span> Configuration
CreateConfiguration()</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum134"> 134:</span> {</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum135"> 135:</span> Configuration
cfg = <span style="color: rgb(0, 0, 255);">new</span> Configuration();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum136"> 136:</span> cfg.Configure();</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum137"> 137:</span>
              <span style="color: rgb(0, 128, 0);">//
implicitamente carichiamo tutti i mapping che si trovano nell'assembly che</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum138"> 138:</span>
              <span style="color: rgb(0, 128, 0);">//
contiene customer</span>
            </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum139"> 139:</span> cfg.AddAssembly(<span style="color: rgb(0, 0, 255);">typeof</span>(Customer).Assembly);</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum140"> 140:</span>
              <span style="color: rgb(0, 0, 255);">return</span> cfg;</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum141"> 141:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum142"> 142:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum143"> 143:</span>  </pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum144"> 144:</span> }</pre>
            <!--CRLF-->
            <pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;">
              <span style="color: rgb(96, 96, 96);" id="lnum145"> 145:</span> }</pre>
            <!--CRLF-->
          </div>
        </div>
        <p>
Ed ecco uno screenshots di come NH opera dietro le quinte:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t20_2.png">
            <img style="border: 0px none; display: block; float: none; margin-left: auto; margin-right: auto;" title="t20" alt="t20" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t20_thumb.png" width="545" border="0" height="501" />
          </a>
        </p>
        <h5>
        </h5>
        <p>
        </p>
        <p>
        </p>
        <p>
Nella prossima parte vedremo meglio i dettagli del file di mapping e il tag <strong>&lt;many-to-one&gt;</strong> insieme
a <strong>&lt;bag&gt;.</strong></p>
        <h4> 
</h4>
        <h4> 
</h4>
        <h4>
          <a href="http://cid-b8821720666a55e7.office.live.com/self.aspx/.Public/NHFormScratch.All.zip" target="_blank">Download
Sorgenti</a>
        </h4>
        <h4>
          <a href="http://www.felicepollano.com/2010/08/28/NHibernatePartireDaZEROParte1CosaCiServe.aspx" target="_blank">Parte
1</a>
        </h4>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=b497bd4a-5353-4921-8bca-f2a29a80b3ec" />
      </body>
      <title>NHibernate: Partire da *ZERO* Parte 2: Creare un progetto</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,b497bd4a-5353-4921-8bca-f2a29a80b3ec.aspx</guid>
      <link>http://www.felicepollano.com/2010/09/01/NHibernatePartireDaZEROParte2CreareUnProgetto.aspx</link>
      <pubDate>Wed, 01 Sep 2010 19:11:59 GMT</pubDate>
      <description>&lt;h5&gt;continua da &lt;a href="http://www.felicepollano.com/2010/08/28/NHibernatePartireDaZEROParte1CosaCiServe.aspx" target="_blank"&gt;Parte1:
Cosa ci serve&lt;/a&gt;
&lt;/h5&gt;
&lt;p align="justify"&gt;
In questa parte costruiamo un progetto con &lt;a href="http://nhforge.org" target="_blank"&gt;NHibernate&lt;/a&gt; che
ci consentirà di persistere una prima entità. In effetti la parte OR/M sarà tenuta
il più semplice possibile, niente reference o collezioni o componenti: l’obiettivo
è creare uno scheletro funzionante e &lt;strong&gt;testabile&lt;/strong&gt;. Ovviamente tutto
quanto detto servirà da spunto, alcune cose potranno sembrare ovvie, altre meno, fate
come credete meglio, ma poichè questo è un corso “da zero” voglio soffermarmi su tutti
i punti.
&lt;/p&gt;
&lt;p align="justify"&gt;
Decidiamo di mettere le entitità in una Class Library ( dll ). Questa è una scelta
che probabilmente sarà conveniente fare anche per una soluzione vera da mandare in
produzione. Creiamo quindi una nuova solution con Visual Studio. Distinguiamo il nome
della soluzione con NHFromScratch.All, ed aggiungiamo all interno un nuovo progetto
di tipo class library, che andiamo a chiamare NHFromScratch.Entities.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t1_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t1" alt="t1" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t1_thumb.png" width="442" border="0" height="263"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
All’ interno della cartella radice della solution, creiamo una sottocartella “Lib”,
atta a contenere le dipendenze della soluzione ( NHibernate e non ), ad esempio in
aggiunta alle dipendenze di NH vedete la nunit.framework.dll, dipendenza che ci servirà
a breve quando vorremo testare le nostre entità.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t2_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t2" alt="t2" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t2_thumb.png" width="378" border="0" height="182"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Bene, il passo successivo è creare il mapping per la prima ed unica entità che vogliamo
gestire. Ci sono una moltitudine di strategie per creare un mapping per NH, quella
che presento qua è una soluzione “plain vanilla”, senza nessun fronzolo e a costo
zero: con la pratica ognuno sceglie il metodo che meglio crede, ma per imparare è
mia opinione che scrivere il file XML sia di aiuto. Aggiungiamo quindi una sottocartella
“Mapping” nella class library appena creata, e in questo folder creiamo un nuovo file
con il nome della entità ( Customer nel nostro caso ) con l’estensione &lt;strong&gt;.hbm.xml&lt;/strong&gt;.
Se abbiamo abilitato l’intellisense, come fortemente consigliato nella &lt;a href="http://www.felicepollano.com/2010/08/28/NHibernatePartireDaZEROParte1CosaCiServe.aspx" target="_blank"&gt;parte
1&lt;/a&gt; l’unico tag che dobbiamo ricordare a memoria è &lt;strong&gt;&amp;lt;hibernate-mapping&amp;gt;,&lt;/strong&gt; tutti
gli altri saranno esposti via intellisense dopo che il namespace sarà correttamente
specificato, come mostrato qui sotto:
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t4_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t4" alt="t4" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t4_thumb.png" width="651" border="0" height="340"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p align="justify"&gt;
Cosa importantissima da ricordare, ricordiamo di impostare &lt;strong&gt;“Embedded Resource”&lt;/strong&gt; come
build action sul file di mapping, altrimenti… la configurazione di NHibernate non
funzionerà. Ad essere precisi questo si potrebbe evitare, ma per farlo dovremmo distribuire
i file di mapping insieme all’applicazione, ed è un’opzione che francamente non mi
piace e nemmeno ho mai visto praticare.
&lt;/p&gt;
&lt;p align="justify"&gt;
Fatto questo non rimane che scrivere difatto il mapping. In questo primo test useremo
solo tre elementi di mapping: &lt;strong&gt;class,key&lt;/strong&gt; e &lt;strong&gt;property&lt;/strong&gt;,
praticamente il minimo indispensabile per avere un entità al lavoro. Approfondiremo
i vari aspetti nelle prossime parti.
&lt;/p&gt;
&lt;div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet"&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;xml&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;version&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="1.0"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;encoding&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="utf-8"&lt;/span&gt; ?&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt; 2:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;hibernate-mapping&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="urn:nhibernate-mapping-2.2"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;namespace&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="NHFromScratch.Entities"&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt; 3:&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;assembly&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="NHFromScratch.Entities"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt; 4:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;class&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Customer"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;table&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Customers"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt; 5:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;id&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Id"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;type&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Int32"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt; 6:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;generator&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="native"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt; 7:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;id&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt; 8:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Name"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;type&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="String"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;not-null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="true"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt; 9:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="AddressLine1"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;type&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="String"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;not-null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="true"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt; 10:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="AddressLine2"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;type&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="String"&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt; 11:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="City"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;type&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="String"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;not-null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="true"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt; 12:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="ZipCode"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;type&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="String"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;not-null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="true"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt; 13:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Active"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;type&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="Boolean"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;not-null&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="true"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;/&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt; 14:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;class&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt; 15:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt; 16:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;hibernate-mapping&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt; 17:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt; 18:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt; 19:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p align="justify"&gt;
Facciamo tuttavia due parole per dire a grandi linee cosa contiene il mapping della
entità Customer. Innanzitutto è specificato il namespace e l’assembly che contiene
l’entità mappata. Questo non è obbligatorio, ma ci consente di scrivere in maniera
più leggibile il nome della classe più avanti. Il tag class indica appunto la classe
che intendiamo utilizzare come entity. Ricordiamo che spesso non esiste un rapporto
1:1 tra tabelle ed entità, ms in questo semplice esempio così accadrà. Il tag class
ci permette di definire il nome della classe, e a quale tabella è associata su DB.
Il tag più sotto &amp;lt;id&amp;gt; è necessario: NHibernate vuole sapere come il database
“distingue” le entità. Ci sono svariati modi per fare questo, e ll modo viene scelto
dal sotto-tag generator: in questo esempio abbiamo specificato un generator “native”,
che significa id univoco assegnato dal DB ( identity, auto-incrementale ) comunque
esso si chiami nel DB target. Successivamente vengono le proprietà, con i loro bei
nomi e tipi dato. Noterete che non ho specificato nessun nome per la corrispondente
colonna sul DB: semplicemente se&amp;nbsp; il nome è uguale nessuno ci obbliga a farlo,
non ripetiamo noi stessi. Anzi, diciamo anche che il tipo sarebbe un surplus se scrivessimo
a mano la classe sottostante: NHibernate usa molto inferire le informazioni ovunque
sia possibile. Noi però la classe non abbiamo voglia di farla a mano, per cui ci serviamo
di &lt;a href="hhttp://nhforge.org/media/p/546.aspx" target="_blank"&gt;hbm2net&lt;/a&gt; ( vedi
la &lt;a href="http://www.felicepollano.com/2010/08/28/NHibernatePartireDaZEROParte1CosaCiServe.aspx" target="_blank"&gt;parte
1&lt;/a&gt; ). Per scatenare questo tool, usiamo un pre build step di Visual Studio, come
quello qui sotto:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t6_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t6" alt="t6" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t6_thumb.png" width="413" border="0" height="231"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
in pratica diciamo ad hbm2net di lavorare su tutti i file .hbm.xml che trova nella
sottocartella mapping della solution, di mettere gli output ( ovvero le classi ) nella
cartella del progetto. Sebbene hbm2net sia un editor template based che può generare
un po’ qualsiasi artefatto partendo dall hbm, senza parametri si limita a generare
le classi corrispondenti al mapping. Lanciando la build nell’output dovreste vedere
il progress anche di hbm2net:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t7_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t7" alt="t7" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t7_thumb.png" width="625" border="0" height="154"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Finita la build, vi trovate il file autogenerato per la entity su file system. Aggiungetelo
al progetto. 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t8_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t8" alt="t8" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t8_thumb.png" width="523" border="0" height="89"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p align="justify"&gt;
Date un’occhiata alla classe autogenerata, date un occhiata anche al mapping: se avete
provato qualche altro tool per NH noterete che il lavoro fatto finora sembra molto
semplificato. Stiamo scrivendo solo lo stretto indispensabile, quello che non ci serve
lo lasciamo assolutamente da parte, perchè questo è &lt;strong&gt;NHibernate da ZERO&lt;/strong&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t9_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t9" alt="t9" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t9_thumb.png" width="199" border="0" height="244"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Bene, per completare la solution aggiungiamo la reference ad NHibernate: &lt;strong&gt;NHibernate
e Iesi.Collection&lt;/strong&gt; sono gli unici assembly che dobbiamo referenziare a tempo
di build. 
&lt;/p&gt;
&lt;p&gt;
E’ finalmente l’ora di andare in test. Aggiungiamo alla solution un progetto di tipo
Class Library, in cui inseriremo gli unit test.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t10_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t10" alt="t10" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t10_thumb.png" width="440" border="0" height="235"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
La solution di test, in modo simile ad un progetto che deve andare in produzione,
necessita delle reference non statiche di NHibernate. Noi le abbiamo nella cartella
Lib della solution, dobbiamo spostarli a fianco della dll di produzione. Possiamo
scegliere di farlo con un post-build step, come illustrato qui sotto.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t11_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t11" alt="t11" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t11_thumb.png" width="381" border="0" height="213"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
Anche le reference di questo progetto sono un po’ più impegnative: ci serve Iesi.Collection
&amp;amp; NHibernate come al solito, ma anche il nostro assembly con le entità, log4net
per il logging, ed in più, ovvviamente, nunit.framework, va da sè.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t12_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t12" alt="t12" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t12_thumb.png" width="244" border="0" height="238"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
A me personalmente piace la barra verde di NUnit, per cui testiamo il progetto con
NUnit, mettendo NUnit.exe come “start external program”.
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t13_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t13" alt="t13" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t13_thumb.png" width="474" border="0" height="143"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
A questo punto creiamo il nostro unit test, con lo scopo di configurare NH, un po’
di log, e vedere se riusciamo a creare il Database. Sì, in questo tutorial il database
non lo facciamo a mano, perchè anche se questo è NHibernate da ZERO, vogliamo scrivere
il meno codice possibile.
&lt;/p&gt;
&lt;p align="justify"&gt;
Il codice dello unit test è qui di seguito:
&lt;/p&gt;
&lt;div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; height: 294px; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet"&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;namespace&lt;/span&gt; NHFromScratch.Tests&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt; 2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt; 3:&lt;/span&gt; [TestFixture]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt; 4:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; TestCustomer&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt; 5:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt; 6:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; TestCustomer()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt; 7:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt; 8:&lt;/span&gt; ConfigureLogForNet();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt; 9:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt; 10:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt; 11:&lt;/span&gt; ISessionFactory
sessionFactory;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt; 12:&lt;/span&gt; [SetUp]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt; 13:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; Setup()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt; 14:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt; 15:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt; 16:&lt;/span&gt; CreateSessionFactory();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt; 17:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt; 18:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt; 19:&lt;/span&gt; [Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum20"&gt; 20:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; CanCreatedatabse()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum21"&gt; 21:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum22"&gt; 22:&lt;/span&gt; SchemaExport
export = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SchemaExport(CreateConfiguration());&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum23"&gt; 23:&lt;/span&gt; export.Execute(&lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum24"&gt; 24:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum25"&gt; 25:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum26"&gt; 26:&lt;/span&gt; [Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum27"&gt; 27:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; CanPersistCustomer()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum28"&gt; 28:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum29"&gt; 29:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
SAVE A CUSTOMER ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum30"&gt; 30:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//save
a customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum31"&gt; 31:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum32"&gt; 32:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt;(var
transaction = session.BeginTransaction())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum33"&gt; 33:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum34"&gt; 34:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum35"&gt; 35:&lt;/span&gt; Customer
c = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Customer()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum36"&gt; 36:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum37"&gt; 37:&lt;/span&gt; Active
= &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum38"&gt; 38:&lt;/span&gt; ,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum39"&gt; 39:&lt;/span&gt; AddressLine1
= &lt;span style="color: rgb(0, 96, 128);"&gt;"xxxx"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum40"&gt; 40:&lt;/span&gt; ,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum41"&gt; 41:&lt;/span&gt; City
= &lt;span style="color: rgb(0, 96, 128);"&gt;"Cuneo"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum42"&gt; 42:&lt;/span&gt; ,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum43"&gt; 43:&lt;/span&gt; Name
= &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill Gates"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum44"&gt; 44:&lt;/span&gt; ,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum45"&gt; 45:&lt;/span&gt; ZipCode
= &lt;span style="color: rgb(0, 96, 128);"&gt;"12060"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum46"&gt; 46:&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum47"&gt; 47:&lt;/span&gt; session.Save(c);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum48"&gt; 48:&lt;/span&gt; transaction.Commit();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum49"&gt; 49:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum50"&gt; 50:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
RETRIEVE A CUSTOMER ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum51"&gt; 51:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//retrieve
a customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum52"&gt; 52:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum53"&gt; 53:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum54"&gt; 54:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum55"&gt; 55:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum56"&gt; 56:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum57"&gt; 57:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum58"&gt; 58:&lt;/span&gt; .UniqueResult();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum59"&gt; 59:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum60"&gt; 60:&lt;/span&gt; Assert.NotNull(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum61"&gt; 61:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum62"&gt; 62:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum63"&gt; 63:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
MODIFY A CUSTOMER ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum64"&gt; 64:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//modify
a customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum65"&gt; 65:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum66"&gt; 66:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
transaction = session.BeginTransaction())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum67"&gt; 67:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum68"&gt; 68:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum69"&gt; 69:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum70"&gt; 70:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum71"&gt; 71:&lt;/span&gt; .UniqueResult&amp;lt;Customer&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum72"&gt; 72:&lt;/span&gt; customer.ZipCode
= &lt;span style="color: rgb(0, 96, 128);"&gt;"0000"&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum73"&gt; 73:&lt;/span&gt; Assert.NotNull(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum74"&gt; 74:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum75"&gt; 75:&lt;/span&gt; transaction.Commit();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum76"&gt; 76:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum77"&gt; 77:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum78"&gt; 78:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum79"&gt; 79:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
VERIFY CUSTOMER IS MODIFIED ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum80"&gt; 80:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//verify
mod&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum81"&gt; 81:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum82"&gt; 82:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum83"&gt; 83:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum84"&gt; 84:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum85"&gt; 85:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum86"&gt; 86:&lt;/span&gt; .UniqueResult&amp;lt;Customer&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum87"&gt; 87:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum88"&gt; 88:&lt;/span&gt; Assert.NotNull(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum89"&gt; 89:&lt;/span&gt; Assert.AreEqual(&lt;span style="color: rgb(0, 96, 128);"&gt;"0000"&lt;/span&gt;,
customer.ZipCode);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum90"&gt; 90:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum91"&gt; 91:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum92"&gt; 92:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum93"&gt; 93:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
DELETE A CUSTOMER ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum94"&gt; 94:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//delete
a customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum95"&gt; 95:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum96"&gt; 96:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
transaction = session.BeginTransaction())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum97"&gt; 97:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum98"&gt; 98:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum99"&gt; 99:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum100"&gt; 100:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum101"&gt; 101:&lt;/span&gt; .UniqueResult();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum102"&gt; 102:&lt;/span&gt; session.Delete(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum103"&gt; 103:&lt;/span&gt; transaction.Commit();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum104"&gt; 104:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum105"&gt; 105:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
VERIFY CUSTOMER IS DELETED ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum106"&gt; 106:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//verify
delete&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum107"&gt; 107:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum108"&gt; 108:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum109"&gt; 109:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum110"&gt; 110:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum111"&gt; 111:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum112"&gt; 112:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum113"&gt; 113:&lt;/span&gt; .UniqueResult();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum114"&gt; 114:&lt;/span&gt; Assert.IsNull(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum115"&gt; 115:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum116"&gt; 116:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum117"&gt; 117:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum118"&gt; 118:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum119"&gt; 119:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum120"&gt; 120:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; ConfigureLogForNet()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum121"&gt; 121:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum122"&gt; 122:&lt;/span&gt; TraceAppender
app = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; TraceAppender();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum123"&gt; 123:&lt;/span&gt; app.Layout
= &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SimpleLayout();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum124"&gt; 124:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//BasicConfigurator.Configure(
app);&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum125"&gt; 125:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum126"&gt; 126:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum127"&gt; 127:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; CreateSessionFactory()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum128"&gt; 128:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum129"&gt; 129:&lt;/span&gt; Configuration
cfg = CreateConfiguration();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum130"&gt; 130:&lt;/span&gt; sessionFactory
= cfg.BuildSessionFactory();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum131"&gt; 131:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum132"&gt; 132:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum133"&gt; 133:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; Configuration
CreateConfiguration()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum134"&gt; 134:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum135"&gt; 135:&lt;/span&gt; Configuration
cfg = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Configuration();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum136"&gt; 136:&lt;/span&gt; cfg.Configure();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum137"&gt; 137:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//
implicitamente carichiamo tutti i mapping che si trovano nell'assembly che&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum138"&gt; 138:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//
contiene customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum139"&gt; 139:&lt;/span&gt; cfg.AddAssembly(&lt;span style="color: rgb(0, 0, 255);"&gt;typeof&lt;/span&gt;(Customer).Assembly);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum140"&gt; 140:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; cfg;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum141"&gt; 141:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum142"&gt; 142:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum143"&gt; 143:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum144"&gt; 144:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum145"&gt; 145:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p align="justify"&gt;
Fatto questo lanciamo il test “CanCreateDatabase” e, come probabilmente sospettiamo,
andiamo in rosso con il logger che dice qualcosa come qua sotto:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t14_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t14" alt="t14" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t14_thumb.png" width="621" border="0" height="266"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
In effetti, ci siamo “dimenticati” di configurare NHibernate, per cui a che DB potrebbe
mai puntare ? Come vedete avere il log abilitato lascia pochi dubbi rispetto a quale
sia l’errore. Tra l’altro manca persino il database…
&lt;/p&gt;
&lt;p&gt;
Quindi creiamo prima un database vuoto, non serve fare nessuna tabella, lasciamo che
sia NHibernate a fare il lavoro sporco
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t16_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t16" alt="t16" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t16_thumb.png" width="345" border="0" height="358"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p align="justify"&gt;
Nell’esempio ho creato un database con nome NHFROMSCRATCH sull’SQLEXPRESS locale.
Poi tornando alla&amp;nbsp; , quando si vedeva il contenuto dello ZIP, rocorderete la
cartella &lt;strong&gt;Configuration_Templates&lt;/strong&gt;: in questa cartella ci sono appunto
dei template di configurazione, in cui basta sostituire un po’ di cose per essere
pronti a lavorare con il db scelto:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t15_4.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t15" alt="t15" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t15_thumb_1.png" width="244" border="0" height="228"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Nel nostro caso scegliamo MSSQL. Il contenuto del file, dopo le modifiche del caso
è questo:
&lt;/p&gt;
&lt;div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet"&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;xml&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;version&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="1.0"&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;encoding&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="utf-8"&lt;/span&gt; ?&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt; 2:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt; 3:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt; 4:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;hibernate-configuration&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;xmlns&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="urn:nhibernate-configuration-2.2"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt; 5:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;session-factory&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="NHibernate.Test"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt; 6:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="connection.driver_class"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;NHibernate.Driver.SqlClientDriver&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt; 7:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="connection.connection_string"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;Server=.\SQLEXPRESS;initial
catalog=NHFROMSCRATCH;Integrated Security=SSPI&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt; 8:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="adonet.batch_size"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;10&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt; 9:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="show_sql"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;true&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt; 10:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="dialect"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;NHibernate.Dialect.MsSql2005Dialect&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt; 11:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="use_outer_join"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;true&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt; 12:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="command_timeout"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;60&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt; 13:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="query.substitutions"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;true
1, false 0, yes 'Y', no 'N'&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt; 14:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt; &lt;span style="color: rgb(255, 0, 0);"&gt;name&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;="proxyfactory.factory_class"&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;NHibernate.ByteCode.LinFu.ProxyFactoryFactory,
NHibernate.ByteCode.LinFu&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;property&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt; 15:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;session-factory&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt; 16:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: rgb(128, 0, 0);"&gt;hibernate-configuration&lt;/span&gt;&lt;span style="color: rgb(0, 0, 255);"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p align="justify"&gt;
Come si vede, le modifiche sostanziali sono nella proprietà connection string, e in
show_sql, che ho messo a true, per visualizzare le query mentre NH le esegue: un trucco
che ci permetterà non tanto di vedere &lt;strong&gt;come&lt;/strong&gt; NHibernate fa le query,
ma piuttosto &lt;strong&gt;quante&lt;/strong&gt; ne fa, per fare performance tuning. Questa sessione
di configurazione potrà essere messa nel file di configurazione dell’applicazione,
o vicino al file binario che la usa in un file di nome &lt;strong&gt;hibernate.cfg.xml&lt;/strong&gt;,
soluzione scelta nell’esempio.
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t17_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="t17" alt="t17" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t17_thumb.png" width="248" border="0" height="348"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Ricordiamoci che, dopo aver inserito il file hibernate.cfg.xml nel progetto, dobbiamo
impostare il flag “copy if newer” cosicchè verrà copiato automaticamente nella cartella
di uscita.
&lt;/p&gt;
&lt;p&gt;
vediamo ora come è fatto il test “&lt;strong&gt;CanCreateDatabase&lt;/strong&gt;”:
&lt;/p&gt;
&lt;div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet"&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt; 1:&lt;/span&gt; [Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt; 2:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; CanCreatedatabse()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt; 3:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt; 4:&lt;/span&gt; SchemaExport
export = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SchemaExport(CreateConfiguration());&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt; 5:&lt;/span&gt; export.Execute(&lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt; 6:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;/div&gt;
&lt;p&gt;
Usiamo la classe di Helper SchemaExport: questa classe, partendo dalla Configurazione
corrente, si occupa di effettuare la &lt;strong&gt;creazione dello schema del database&lt;/strong&gt;.
Ora lanciando il test questi si comporta meglio, e nella porzione console è possibile&amp;nbsp;
vedere la DDL che è stata inviata al database.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t18_2.png"&gt;&lt;img style="border: 0px none; display: block; float: none; margin-left: auto; margin-right: auto;" title="t18" alt="t18" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t18_thumb.png" width="796" border="0" height="452"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Tramite il flag della funzione Export, è possibile sottometere lo script al sistema
database sottostante, nel nostro caso otterremo su DB l’unica tabella del nostro minuscolo
modello di test:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t19_2.png"&gt;&lt;img style="border: 0px none; display: block; float: none; margin-left: auto; margin-right: auto;" title="t19" alt="t19" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t19_thumb.png" width="244" border="0" height="203"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Quindi facciamo un breve recap fino a questo punto: con un solo file ( il mapping
appunto ) abbiamo creato un database e il codice c#. Tutto questo grazie ad hbm2net,
che è un code generator open source recuoperabile da &lt;a href="https://sourceforge.net/projects/nhcontrib/" target="_blank"&gt;NHContrib&lt;/a&gt;.
Con un po’ di pazienza è possibil emodificare e/o scrivere template aggiuntivi per
hbm2net per geenrare altri tipidi artefacts, ad esempio DTO o altro, ma questo sarà
visto più avanti. In pratica possiamo vedere hbm2net come un generatore di codice
programmabile, che di default produce il codice delle entity partendo dai file hbm.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t18b_2.png"&gt;&lt;img style="border: 0px none; display: block; float: none; margin-left: auto; margin-right: auto;" title="t18b" alt="t18b" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t18b_thumb.png" width="351" border="0" height="264"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Ora possiamo scrivere il codice di prova per il modello. Mettendo a “true” il valore
di show_sql nella configurazione, NH manda in standard output le query, per cui in
debug è possibile ispezionare cosa succede dietro le quinte. Il nostro semplice unit
test crea/modifica/cancella una semplice istanza della entità customer, eco il codice
dello unit test che fa tutto questo:
&lt;/p&gt;
&lt;div style="border: 1px solid silver; text-align: left; padding: 4px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 20px 0px 10px; width: 97.5%; font-family: 'Courier New',courier,monospace; direction: ltr; max-height: 200px; font-size: 8pt; overflow: auto; cursor: text;" id="codeSnippetWrapper"&gt;
&lt;div style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;" id="codeSnippet"&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum1"&gt; 1:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;namespace&lt;/span&gt; NHFromScratch.Tests&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum2"&gt; 2:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum3"&gt; 3:&lt;/span&gt; [TestFixture]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum4"&gt; 4:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;class&lt;/span&gt; TestCustomer&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum5"&gt; 5:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum6"&gt; 6:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; TestCustomer()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum7"&gt; 7:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum8"&gt; 8:&lt;/span&gt; ConfigureLogForNet();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum9"&gt; 9:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum10"&gt; 10:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum11"&gt; 11:&lt;/span&gt; ISessionFactory
sessionFactory;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum12"&gt; 12:&lt;/span&gt; [SetUp]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum13"&gt; 13:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; Setup()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum14"&gt; 14:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum15"&gt; 15:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum16"&gt; 16:&lt;/span&gt; CreateSessionFactory();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum17"&gt; 17:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum18"&gt; 18:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum19"&gt; 19:&lt;/span&gt; [Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum20"&gt; 20:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; CanCreatedatabse()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum21"&gt; 21:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum22"&gt; 22:&lt;/span&gt; SchemaExport
export = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SchemaExport(CreateConfiguration());&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum23"&gt; 23:&lt;/span&gt; export.Execute(&lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;, &lt;span style="color: rgb(0, 0, 255);"&gt;false&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum24"&gt; 24:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum25"&gt; 25:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum26"&gt; 26:&lt;/span&gt; [Test]&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum27"&gt; 27:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;public&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; CanPersistCustomer()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum28"&gt; 28:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum29"&gt; 29:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
SAVE A CUSTOMER ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum30"&gt; 30:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//save
a customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum31"&gt; 31:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum32"&gt; 32:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt;(var
transaction = session.BeginTransaction())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum33"&gt; 33:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum34"&gt; 34:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum35"&gt; 35:&lt;/span&gt; Customer
c = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Customer()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum36"&gt; 36:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum37"&gt; 37:&lt;/span&gt; Active
= &lt;span style="color: rgb(0, 0, 255);"&gt;true&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum38"&gt; 38:&lt;/span&gt; ,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum39"&gt; 39:&lt;/span&gt; AddressLine1
= &lt;span style="color: rgb(0, 96, 128);"&gt;"xxxx"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum40"&gt; 40:&lt;/span&gt; ,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum41"&gt; 41:&lt;/span&gt; City
= &lt;span style="color: rgb(0, 96, 128);"&gt;"Cuneo"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum42"&gt; 42:&lt;/span&gt; ,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum43"&gt; 43:&lt;/span&gt; Name
= &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill Gates"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum44"&gt; 44:&lt;/span&gt; ,&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum45"&gt; 45:&lt;/span&gt; ZipCode
= &lt;span style="color: rgb(0, 96, 128);"&gt;"12060"&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum46"&gt; 46:&lt;/span&gt; };&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum47"&gt; 47:&lt;/span&gt; session.Save(c);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum48"&gt; 48:&lt;/span&gt; transaction.Commit();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum49"&gt; 49:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum50"&gt; 50:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
RETRIEVE A CUSTOMER ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum51"&gt; 51:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//retrieve
a customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum52"&gt; 52:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum53"&gt; 53:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum54"&gt; 54:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum55"&gt; 55:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum56"&gt; 56:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum57"&gt; 57:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum58"&gt; 58:&lt;/span&gt; .UniqueResult();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum59"&gt; 59:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum60"&gt; 60:&lt;/span&gt; Assert.NotNull(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum61"&gt; 61:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum62"&gt; 62:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum63"&gt; 63:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
MODIFY A CUSTOMER ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum64"&gt; 64:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//modify
a customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum65"&gt; 65:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum66"&gt; 66:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
transaction = session.BeginTransaction())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum67"&gt; 67:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum68"&gt; 68:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum69"&gt; 69:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum70"&gt; 70:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum71"&gt; 71:&lt;/span&gt; .UniqueResult&amp;lt;Customer&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum72"&gt; 72:&lt;/span&gt; customer.ZipCode
= &lt;span style="color: rgb(0, 96, 128);"&gt;"0000"&lt;/span&gt;;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum73"&gt; 73:&lt;/span&gt; Assert.NotNull(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum74"&gt; 74:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum75"&gt; 75:&lt;/span&gt; transaction.Commit();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum76"&gt; 76:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum77"&gt; 77:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum78"&gt; 78:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum79"&gt; 79:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
VERIFY CUSTOMER IS MODIFIED ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum80"&gt; 80:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//verify
mod&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum81"&gt; 81:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum82"&gt; 82:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum83"&gt; 83:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum84"&gt; 84:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum85"&gt; 85:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum86"&gt; 86:&lt;/span&gt; .UniqueResult&amp;lt;Customer&amp;gt;();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum87"&gt; 87:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum88"&gt; 88:&lt;/span&gt; Assert.NotNull(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum89"&gt; 89:&lt;/span&gt; Assert.AreEqual(&lt;span style="color: rgb(0, 96, 128);"&gt;"0000"&lt;/span&gt;,
customer.ZipCode);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum90"&gt; 90:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum91"&gt; 91:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum92"&gt; 92:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum93"&gt; 93:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
DELETE A CUSTOMER ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum94"&gt; 94:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//delete
a customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum95"&gt; 95:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum96"&gt; 96:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
transaction = session.BeginTransaction())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum97"&gt; 97:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum98"&gt; 98:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum99"&gt; 99:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum100"&gt; 100:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum101"&gt; 101:&lt;/span&gt; .UniqueResult();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum102"&gt; 102:&lt;/span&gt; session.Delete(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum103"&gt; 103:&lt;/span&gt; transaction.Commit();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum104"&gt; 104:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum105"&gt; 105:&lt;/span&gt; Console.WriteLine(&lt;span style="color: rgb(0, 96, 128);"&gt;"\n******
VERIFY CUSTOMER IS DELETED ********"&lt;/span&gt;);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum106"&gt; 106:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//verify
delete&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum107"&gt; 107:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;using&lt;/span&gt; (var
session = sessionFactory.OpenSession())&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum108"&gt; 108:&lt;/span&gt; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum109"&gt; 109:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum110"&gt; 110:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum111"&gt; 111:&lt;/span&gt; var
customer = session.CreateCriteria&amp;lt;Customer&amp;gt;()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum112"&gt; 112:&lt;/span&gt; .Add(Expression.Eq(&lt;span style="color: rgb(0, 96, 128);"&gt;"Name"&lt;/span&gt;, &lt;span style="color: rgb(0, 96, 128);"&gt;"Bill
Gates"&lt;/span&gt;))&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum113"&gt; 113:&lt;/span&gt; .UniqueResult();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum114"&gt; 114:&lt;/span&gt; Assert.IsNull(customer);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum115"&gt; 115:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum116"&gt; 116:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum117"&gt; 117:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum118"&gt; 118:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum119"&gt; 119:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum120"&gt; 120:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; ConfigureLogForNet()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum121"&gt; 121:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum122"&gt; 122:&lt;/span&gt; TraceAppender
app = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; TraceAppender();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum123"&gt; 123:&lt;/span&gt; app.Layout
= &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; SimpleLayout();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum124"&gt; 124:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//BasicConfigurator.Configure(
app);&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum125"&gt; 125:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum126"&gt; 126:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum127"&gt; 127:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;void&lt;/span&gt; CreateSessionFactory()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum128"&gt; 128:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum129"&gt; 129:&lt;/span&gt; Configuration
cfg = CreateConfiguration();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum130"&gt; 130:&lt;/span&gt; sessionFactory
= cfg.BuildSessionFactory();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum131"&gt; 131:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum132"&gt; 132:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum133"&gt; 133:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;private&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;static&lt;/span&gt; Configuration
CreateConfiguration()&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum134"&gt; 134:&lt;/span&gt; {&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum135"&gt; 135:&lt;/span&gt; Configuration
cfg = &lt;span style="color: rgb(0, 0, 255);"&gt;new&lt;/span&gt; Configuration();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum136"&gt; 136:&lt;/span&gt; cfg.Configure();&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum137"&gt; 137:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//
implicitamente carichiamo tutti i mapping che si trovano nell'assembly che&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum138"&gt; 138:&lt;/span&gt; &lt;span style="color: rgb(0, 128, 0);"&gt;//
contiene customer&lt;/span&gt;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum139"&gt; 139:&lt;/span&gt; cfg.AddAssembly(&lt;span style="color: rgb(0, 0, 255);"&gt;typeof&lt;/span&gt;(Customer).Assembly);&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum140"&gt; 140:&lt;/span&gt; &lt;span style="color: rgb(0, 0, 255);"&gt;return&lt;/span&gt; cfg;&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum141"&gt; 141:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum142"&gt; 142:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum143"&gt; 143:&lt;/span&gt;&amp;nbsp; &lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: rgb(244, 244, 244); margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum144"&gt; 144:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;&lt;pre style="border-style: none; text-align: left; padding: 0px; line-height: 12pt; background-color: white; margin: 0em; width: 100%; font-family: 'Courier New',courier,monospace; direction: ltr; color: black; font-size: 8pt; overflow: visible;"&gt;&lt;span style="color: rgb(96, 96, 96);" id="lnum145"&gt; 145:&lt;/span&gt; }&lt;/pre&gt;
&lt;!--CRLF--&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;p&gt;
Ed ecco uno screenshots di come NH opera dietro le quinte:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t20_2.png"&gt;&lt;img style="border: 0px none; display: block; float: none; margin-left: auto; margin-right: auto;" title="t20" alt="t20" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte2Creareunpro_D163/t20_thumb.png" width="545" border="0" height="501"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;h5&gt;
&lt;/h5&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
Nella prossima parte vedremo meglio i dettagli del file di mapping e il tag &lt;strong&gt;&amp;lt;many-to-one&amp;gt;&lt;/strong&gt; insieme
a &lt;strong&gt;&amp;lt;bag&amp;gt;.&lt;/strong&gt;
&lt;/p&gt;
&lt;h4&gt;&amp;nbsp;
&lt;/h4&gt;
&lt;h4&gt;&amp;nbsp;
&lt;/h4&gt;
&lt;h4&gt;&lt;a href="http://cid-b8821720666a55e7.office.live.com/self.aspx/.Public/NHFormScratch.All.zip" target="_blank"&gt;Download
Sorgenti&lt;/a&gt;
&lt;/h4&gt;
&lt;h4&gt;&lt;a href="http://www.felicepollano.com/2010/08/28/NHibernatePartireDaZEROParte1CosaCiServe.aspx" target="_blank"&gt;Parte
1&lt;/a&gt;
&lt;/h4&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=b497bd4a-5353-4921-8bca-f2a29a80b3ec" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,b497bd4a-5353-4921-8bca-f2a29a80b3ec.aspx</comments>
      <category>NHibernate</category>
      <category>NHibernate Tutorial</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=34c60179-64c5-40be-a422-94ddab80399e</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,34c60179-64c5-40be-a422-94ddab80399e.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,34c60179-64c5-40be-a422-94ddab80399e.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=34c60179-64c5-40be-a422-94ddab80399e</wfw:commentRss>
      <slash:comments>5</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <address align="justify">
          <a href="http://www.felicepollano.com/2010/09/01/NHibernatePartireDaZEROParte2CreareUnProgetto.aspx">Vai
alla parte 2: Creare un progetto</a>
          <br />
        </address>
        <p align="justify">
Mi è ventuta l’idea di produrre una serie di post che consentano a chi vuole iniziare
a lavorare con <a href="http://nhforge.org" target="_blank">NHibernate</a>, o almeno
a provare per vedere se questo OR/M è la scelta giusta, di creare in modo ordinato
un ambiente di test pulito, sapendo bene cosa serve, evitando il percorso “pasticciato”
che spesso si fa all’inizio. 
</p>
        <p align="justify">
Bene, come partenza bisogna scaricare NHibernate. Il posto giusto dove farlo è il <a href="http://sourceforge.net/projects/nhibernate/files/">progetto
su sourceforge</a>, e il modo giusto di farlo è procurare i file binary necessari.
Scaricare i sorgenti per il momento può essere tranquillamente tralasciato. Puntando
al <a href="http://sourceforge.net/projects/nhibernate/files/">link di download</a>,
vi trovate qualcosa del genere:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s1_4.png">
            <img style="border-width: 0px; display: inline;" title="s1" alt="s1" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s1_thumb_1.png" width="472" border="0" height="451" />
          </a>
        </p>
        <p align="justify">
Come vedete ci sono più versioni, ed anche una ultima release, che in questo caso
è la 3.0.0 Alpha2. Io ho cerchiato la versione 2.1.2 GA che è quella che useremo per
questa serie di articoli, ma ho anche cerchiato GA: “<strong>general availability</strong>”.
Dunque, perchè non ho scaricato l’ultima versione ? Cosa significa GA ? NHibernate
ha una politica di rilascio ben consolidata, e marca con GA le versioni “da produzione”.
Quindi, se non siete a conoscenza di qualche funzionalità particolare che c’è solo
nella alpha di turno, se non siete dell’idea di vedervi cambiate sotto il naso funzioni
e comportamenti, scaricate le versioni GA più recenti che trovate. Non esistono al
momento “Setup” di NHibernate, mi risulta che ci fosse qualcosa in passato, comunque
anche se trovaste qualcosa, vi suggerisco di evitarlo: NH consente di fare un private
deploy, e avere traccia di quello che serve ci sarà utile in fase di consegna dell’applicativo
sulle macchine di produzione. Scarichiamo quindi il file <a href="http://sourceforge.net/projects/nhibernate/files/NHibernate/2.1.2GA/NHibernate.Linq-2.1.2-GA-Bin.zip/download">NHIbernate-2.1.2.GA-bin.zip</a>.
Scaricato il file il layout del contenuto è quello schematizzato qui sotto:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s2_2.png">
            <img style="border-width: 0px; display: inline;" title="s2" alt="s2" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s2_thumb.png" width="469" border="0" height="392" />
          </a>
        </p>
        <p align="justify">
Nella root, oltre ad un po’ di paccottiglia varia, troviamo <strong>due folder importanti</strong> che
sono quelli che ci <strong>servono per mettere NHibernate all’opera</strong>: <strong>Required_Bins</strong>,
and <strong>Required_For_LazyLoading</strong>.Tutte le dll contenute nel file required
bin devono essere rilasciate insieme all’applicazione ( oltre a servire ovviamente 
in fase di sviluppo :) ), mentre dalla cartella Required_For_LazyLoading si può scegliere
quale folder distribuire in base a quale proxy generator si sceglie. Questo è un tema
che si vedrà più avanti, per adesso basta sapere che NHibernate può derivare internamente
alcune delle nostre classi quando decidiamo di avere delle entità “Lazy”, e questo
è ottenuto tramite delle librerie esterne di generazione di classi “proxy”. <strong>Quale
proxy generator usare dipende dalla configurazione</strong>, e quindi <strong>dalla
stessa configurazione dipende quale folder distribuire</strong>. Negli esempi useremo
LinFu. Diciamo che questa scelta è di scarso impatto sulla vita del vostro progetto,
salvo in situazioni particolari, per cui per il momento possiamo andare avanti.
</p>
        <p align="justify">
Importantissimi in fase di sviluppo sono i file <strong>nhibernate-mapping.xsd</strong> e <strong>nhibernate-configuration.xsd</strong>.
Questi due file vi <strong>consentono di avere l’intellisense abilitato</strong> per
i file di mapping e per la configurazione, e quindi sono assolutamente indispensabili.
Malgrado siano finiti nella cartella required_bin, sono invece praticamente inutili
in fase di distribuzione. <strong>Per attivare l’intellisense occorre</strong> copiare
i due file suddetti nella cartella apposita di visual studio:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s3_2.png">
            <img style="border-width: 0px; display: inline;" title="s3" alt="s3" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s3_thumb.png" width="168" border="0" height="385" />
          </a>
        </p>
        <p align="justify">
Attenzione: può succedere che imporvvisamente Visual Studio smetta di fornire l'intellisense:
tipicamente questo accade perchè ci sono più versioni dello stesso schema XML associate. <a href="http://www.felicepollano.com/2010/09/03/AiutooooNonFunzionaPi%C3%B9LintellisenseDiNHibernate.aspx">Date
un occhiata a questo post che spiega come risolvere il problema</a>.<br /></p>
        <p align="justify">
Inoltre, per sviluppare e per seguire gli esempi in questo tutorial occorrerà NUnit.
Se ce lo avete già usate quello, altrimenti <a href="http://www.nunit.org/index.php?p=download">recuperate
l’ultima versione dal sito ufficiale</a>. Io di solito scarico il binario, non il
setup, e lo scompatto sotto il folder programmi. Anche NUnit funziona con il semplice
deploy Xcopy.
</p>
        <p align="justify">
Ultima cosa prima di partire, lavorando con NHibernate ci sono alcune attività ripetitive
che sarebbe bello evitare: consiglio di scaricare anche il tool <a href="hhttp://nhforge.org/media/p/546.aspx" target="_blank">hbm2net</a> che
ci consentirà di generare automaticamente le classi per nel corso del tutorial. <a href="http://sourceforge.net/projects/nhcontrib/files/" target="_blank">Il
tool si trova nel progetto NHContrib</a>. Scaricate e scompattate lo zip in un folder,
per esempio in C:\hbm2net. Il tool è un compilatore linea di comando, e sarà lanciato
automaticamente da Visual Studio, ma perchè ciò avvenga occorre aggiungere la cartella
in cui avete messo hbm2net nella variabile di ambiente PATH. per fare questo raggiungete
le “proprietà del Sistema”:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s5_2.png">
            <img style="border-width: 0px; display: inline;" title="s5" alt="s5" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s5_thumb.png" width="300" border="0" height="370" />
          </a>
        </p>
        <p align="justify">
e poi aggiungere il path suddetto alla variabile PATH:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s6_2.png">
            <img style="border-width: 0px; display: inline;" title="s6" alt="s6" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s6_thumb.png" width="305" border="0" height="371" />
          </a>
        </p>
        <p align="justify">
 
</p>
        <p>
        </p>
        <p>
        </p>
        <p>
        </p>
        <p>
          <a href="http://www.felicepollano.com/2010/09/01/NHibernatePartireDaZEROParte2CreareUnProgetto.aspx" target="_blank">Nella
Parte2 vediamo come organizzare un progetto con NH</a>.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=34c60179-64c5-40be-a422-94ddab80399e" />
      </body>
      <title>NHibernate: Partire da *ZERO* Parte 1: Cosa ci serve</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,34c60179-64c5-40be-a422-94ddab80399e.aspx</guid>
      <link>http://www.felicepollano.com/2010/08/28/NHibernatePartireDaZEROParte1CosaCiServe.aspx</link>
      <pubDate>Sat, 28 Aug 2010 11:57:29 GMT</pubDate>
      <description>&lt;address align="justify"&gt;&lt;a href="http://www.felicepollano.com/2010/09/01/NHibernatePartireDaZEROParte2CreareUnProgetto.aspx"&gt;Vai
alla parte 2: Creare un progetto&lt;/a&gt;
&lt;br&gt;
&lt;/address&gt;
&lt;p align="justify"&gt;
Mi è ventuta l’idea di produrre una serie di post che consentano a chi vuole iniziare
a lavorare con &lt;a href="http://nhforge.org" target="_blank"&gt;NHibernate&lt;/a&gt;, o almeno
a provare per vedere se questo OR/M è la scelta giusta, di creare in modo ordinato
un ambiente di test pulito, sapendo bene cosa serve, evitando il percorso “pasticciato”
che spesso si fa all’inizio. 
&lt;/p&gt;
&lt;p align="justify"&gt;
Bene, come partenza bisogna scaricare NHibernate. Il posto giusto dove farlo è il &lt;a href="http://sourceforge.net/projects/nhibernate/files/"&gt;progetto
su sourceforge&lt;/a&gt;, e il modo giusto di farlo è procurare i file binary necessari.
Scaricare i sorgenti per il momento può essere tranquillamente tralasciato. Puntando
al &lt;a href="http://sourceforge.net/projects/nhibernate/files/"&gt;link di download&lt;/a&gt;,
vi trovate qualcosa del genere:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s1_4.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="s1" alt="s1" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s1_thumb_1.png" width="472" border="0" height="451"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
Come vedete ci sono più versioni, ed anche una ultima release, che in questo caso
è la 3.0.0 Alpha2. Io ho cerchiato la versione 2.1.2 GA che è quella che useremo per
questa serie di articoli, ma ho anche cerchiato GA: “&lt;strong&gt;general availability&lt;/strong&gt;”.
Dunque, perchè non ho scaricato l’ultima versione ? Cosa significa GA ? NHibernate
ha una politica di rilascio ben consolidata, e marca con GA le versioni “da produzione”.
Quindi, se non siete a conoscenza di qualche funzionalità particolare che c’è solo
nella alpha di turno, se non siete dell’idea di vedervi cambiate sotto il naso funzioni
e comportamenti, scaricate le versioni GA più recenti che trovate. Non esistono al
momento “Setup” di NHibernate, mi risulta che ci fosse qualcosa in passato, comunque
anche se trovaste qualcosa, vi suggerisco di evitarlo: NH consente di fare un private
deploy, e avere traccia di quello che serve ci sarà utile in fase di consegna dell’applicativo
sulle macchine di produzione. Scarichiamo quindi il file &lt;a href="http://sourceforge.net/projects/nhibernate/files/NHibernate/2.1.2GA/NHibernate.Linq-2.1.2-GA-Bin.zip/download"&gt;NHIbernate-2.1.2.GA-bin.zip&lt;/a&gt;.
Scaricato il file il layout del contenuto è quello schematizzato qui sotto:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s2_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="s2" alt="s2" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s2_thumb.png" width="469" border="0" height="392"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
Nella root, oltre ad un po’ di paccottiglia varia, troviamo &lt;strong&gt;due folder importanti&lt;/strong&gt; che
sono quelli che ci &lt;strong&gt;servono per mettere NHibernate all’opera&lt;/strong&gt;: &lt;strong&gt;Required_Bins&lt;/strong&gt;,
and &lt;strong&gt;Required_For_LazyLoading&lt;/strong&gt;.Tutte le dll contenute nel file required
bin devono essere rilasciate insieme all’applicazione ( oltre a servire ovviamente&amp;nbsp;
in fase di sviluppo :) ), mentre dalla cartella Required_For_LazyLoading si può scegliere
quale folder distribuire in base a quale proxy generator si sceglie. Questo è un tema
che si vedrà più avanti, per adesso basta sapere che NHibernate può derivare internamente
alcune delle nostre classi quando decidiamo di avere delle entità “Lazy”, e questo
è ottenuto tramite delle librerie esterne di generazione di classi “proxy”. &lt;strong&gt;Quale
proxy generator usare dipende dalla configurazione&lt;/strong&gt;, e quindi &lt;strong&gt;dalla
stessa configurazione dipende quale folder distribuire&lt;/strong&gt;. Negli esempi useremo
LinFu. Diciamo che questa scelta è di scarso impatto sulla vita del vostro progetto,
salvo in situazioni particolari, per cui per il momento possiamo andare avanti.
&lt;/p&gt;
&lt;p align="justify"&gt;
Importantissimi in fase di sviluppo sono i file &lt;strong&gt;nhibernate-mapping.xsd&lt;/strong&gt; e &lt;strong&gt;nhibernate-configuration.xsd&lt;/strong&gt;.
Questi due file vi &lt;strong&gt;consentono di avere l’intellisense abilitato&lt;/strong&gt; per
i file di mapping e per la configurazione, e quindi sono assolutamente indispensabili.
Malgrado siano finiti nella cartella required_bin, sono invece praticamente inutili
in fase di distribuzione. &lt;strong&gt;Per attivare l’intellisense occorre&lt;/strong&gt; copiare
i due file suddetti nella cartella apposita di visual studio:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s3_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="s3" alt="s3" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s3_thumb.png" width="168" border="0" height="385"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
Attenzione: può succedere che imporvvisamente Visual Studio smetta di fornire l'intellisense:
tipicamente questo accade perchè ci sono più versioni dello stesso schema XML associate. &lt;a href="http://www.felicepollano.com/2010/09/03/AiutooooNonFunzionaPi%C3%B9LintellisenseDiNHibernate.aspx"&gt;Date
un occhiata a questo post che spiega come risolvere il problema&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;p align="justify"&gt;
Inoltre, per sviluppare e per seguire gli esempi in questo tutorial occorrerà NUnit.
Se ce lo avete già usate quello, altrimenti &lt;a href="http://www.nunit.org/index.php?p=download"&gt;recuperate
l’ultima versione dal sito ufficiale&lt;/a&gt;. Io di solito scarico il binario, non il
setup, e lo scompatto sotto il folder programmi. Anche NUnit funziona con il semplice
deploy Xcopy.
&lt;/p&gt;
&lt;p align="justify"&gt;
Ultima cosa prima di partire, lavorando con NHibernate ci sono alcune attività ripetitive
che sarebbe bello evitare: consiglio di scaricare anche il tool &lt;a href="hhttp://nhforge.org/media/p/546.aspx" target="_blank"&gt;hbm2net&lt;/a&gt; che
ci consentirà di generare automaticamente le classi per nel corso del tutorial. &lt;a href="http://sourceforge.net/projects/nhcontrib/files/" target="_blank"&gt;Il
tool si trova nel progetto NHContrib&lt;/a&gt;. Scaricate e scompattate lo zip in un folder,
per esempio in C:\hbm2net. Il tool è un compilatore linea di comando, e sarà lanciato
automaticamente da Visual Studio, ma perchè ciò avvenga occorre aggiungere la cartella
in cui avete messo hbm2net nella variabile di ambiente PATH. per fare questo raggiungete
le “proprietà del Sistema”:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s5_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="s5" alt="s5" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s5_thumb.png" width="300" border="0" height="370"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
e poi aggiungere il path suddetto alla variabile PATH:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s6_2.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="s6" alt="s6" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernatePartiredaZEROParte1cosaciserve_ACE4/s6_thumb.png" width="305" border="0" height="371"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/2010/09/01/NHibernatePartireDaZEROParte2CreareUnProgetto.aspx" target="_blank"&gt;Nella
Parte2 vediamo come organizzare un progetto con NH&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=34c60179-64c5-40be-a422-94ddab80399e" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,34c60179-64c5-40be-a422-94ddab80399e.aspx</comments>
      <category>NHibernate</category>
      <category>NHibernate Tutorial</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=5d842446-2e72-4ab3-913f-81630f9b9260</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,5d842446-2e72-4ab3-913f-81630f9b9260.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,5d842446-2e72-4ab3-913f-81630f9b9260.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5d842446-2e72-4ab3-913f-81630f9b9260</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
For maintenance reasons sometime the original NHForge location is not available. In
such a case you can download the file containing the binary release of the tools in
the original <a href="https://sourceforge.net/projects/nhcontrib/" target="_blank">NHContrib</a> project <a href="http://sourceforge.net/projects/nhcontrib/files/" target="_blank">download
location</a>:
</p>
        <p>
          <a href="http://sourceforge.net/projects/nhcontrib/files/">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="nhcontribdownload" border="0" alt="nhcontribdownload" src="http://www.felicepollano.com/public/WindowsLiveWriter/WhereareHbm2netDb2hbm_137DA/nhcontribdownload_3.png" width="569" height="445" />
          </a>
        </p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=5d842446-2e72-4ab3-913f-81630f9b9260" />
      </body>
      <title>Where are Hbm2net / Db2hbm ?</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,5d842446-2e72-4ab3-913f-81630f9b9260.aspx</guid>
      <link>http://www.felicepollano.com/2010/08/11/WhereAreHbm2netDb2hbm.aspx</link>
      <pubDate>Wed, 11 Aug 2010 20:10:41 GMT</pubDate>
      <description>&lt;p&gt;
For maintenance reasons sometime the original NHForge location is not available. In
such a case you can download the file containing the binary release of the tools in
the original &lt;a href="https://sourceforge.net/projects/nhcontrib/" target="_blank"&gt;NHContrib&lt;/a&gt; project &lt;a href="http://sourceforge.net/projects/nhcontrib/files/" target="_blank"&gt;download
location&lt;/a&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sourceforge.net/projects/nhcontrib/files/"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="nhcontribdownload" border="0" alt="nhcontribdownload" src="http://www.felicepollano.com/public/WindowsLiveWriter/WhereareHbm2netDb2hbm_137DA/nhcontribdownload_3.png" width="569" height="445"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=5d842446-2e72-4ab3-913f-81630f9b9260" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,5d842446-2e72-4ab3-913f-81630f9b9260.aspx</comments>
      <category>db2hbm</category>
      <category>hbm2net</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=076da4eb-7062-41e2-9ad9-d82168a2e02f</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,076da4eb-7062-41e2-9ad9-d82168a2e02f.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,076da4eb-7062-41e2-9ad9-d82168a2e02f.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=076da4eb-7062-41e2-9ad9-d82168a2e02f</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
 <a href="http://jfromaniello.blogspot.com/" target="_blank">José Romaniello</a> is
doing progress in <a href="http://hqladdin.codeplex.com/team/view" target="_blank">hql
intellisense for Visual Studio 2010</a>. He manage to integrate some <a href="http://www.felicepollano.com/CategoryView,category,NHWorkBench.aspx" target="_blank">NHWorkbench</a> codebase
into it, to have some intellisense working. Even if the project is still in alpha, <a href="http://hqladdin.codeplex.com/wikipage?title=HowTo%20register%20queries%20from%20HQL%20files" target="_blank">I
suggest you to download and install to give it a try</a>.
</p>
        <p>
Here below a screenshot of the tool at work:
</p>
        <p>
 
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/HqlInvisualstudiogrowing_E770/image_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/HqlInvisualstudiogrowing_E770/image_thumb.png" width="508" height="283" />
          </a>
        </p>
        <p>
Nice, isn’t it ?
</p>
        <p>
As an addition I was added to the project by Josè, and I would be happy to add some
contribution to this important project for the <a href="http://nhforge.org" target="_blank">NHibernate</a> ecosystem.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=076da4eb-7062-41e2-9ad9-d82168a2e02f" />
      </body>
      <title>Hql In visual studio growing</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,076da4eb-7062-41e2-9ad9-d82168a2e02f.aspx</guid>
      <link>http://www.felicepollano.com/2010/07/31/HqlInVisualStudioGrowing.aspx</link>
      <pubDate>Sat, 31 Jul 2010 14:27:17 GMT</pubDate>
      <description>&lt;p&gt;
&amp;nbsp;&lt;a href="http://jfromaniello.blogspot.com/" target="_blank"&gt;José Romaniello&lt;/a&gt; is
doing progress in &lt;a href="http://hqladdin.codeplex.com/team/view" target="_blank"&gt;hql
intellisense for Visual Studio 2010&lt;/a&gt;. He manage to integrate some &lt;a href="http://www.felicepollano.com/CategoryView,category,NHWorkBench.aspx" target="_blank"&gt;NHWorkbench&lt;/a&gt; codebase
into it, to have some intellisense working. Even if the project is still in alpha, &lt;a href="http://hqladdin.codeplex.com/wikipage?title=HowTo%20register%20queries%20from%20HQL%20files" target="_blank"&gt;I
suggest you to download and install to give it a try&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
Here below a screenshot of the tool at work:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/HqlInvisualstudiogrowing_E770/image_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" src="http://www.felicepollano.com/public/WindowsLiveWriter/HqlInvisualstudiogrowing_E770/image_thumb.png" width="508" height="283"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
Nice, isn’t it ?
&lt;/p&gt;
&lt;p&gt;
As an addition I was added to the project by Josè, and I would be happy to add some
contribution to this important project for the &lt;a href="http://nhforge.org" target="_blank"&gt;NHibernate&lt;/a&gt; ecosystem.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=076da4eb-7062-41e2-9ad9-d82168a2e02f" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,076da4eb-7062-41e2-9ad9-d82168a2e02f.aspx</comments>
      <category>HQL language Service</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=87e2e085-8f21-4ec3-ba92-972d5456959b</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,87e2e085-8f21-4ec3-ba92-972d5456959b.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,87e2e085-8f21-4ec3-ba92-972d5456959b.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=87e2e085-8f21-4ec3-ba92-972d5456959b</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
Apprendo da questo <a href="http://fabiomaulo.blogspot.com/2010/07/enhanced-query-object.html" target="_blank">post</a> di <a href="http://fabiomaulo.blogspot.com/" target="_blank">Fabio
Maulo</a> una interessante feature di <a href="http://nhforge.org" target="_blank">NHibernate</a> 3
implementata nel nuovo subset di API: <a href="http://nhforge.org/blogs/nhibernate/archive/2009/12/17/queryover-in-nh-3-0.aspx" target="_blank">QueryOver</a>.
Il post di Fabio approfondisce il pattern Query Object, e quello che salta all’occhio
è la pulizia con cui si riesca finalmemte a farte un paging “ad arte”. Per fare l’accesso
paginato in generale occorre avere il count delle righe che il sistema vorrebbe tornarci,
e questo constringeva in passato a fare delle implementazioni un po’ sporche in cui
si era costretti a specificare la query di selezione e quella di count. QueryOver
propone la funzione <strong><em>query.ToRowCountQuery();</em></strong> – dove query
è appunto una query di QueryOver, e la funzione ci restituisce la query di conteggio
in modo pulito e trasparente. Assolutamente molto utile. Io non sono uno da trunk,
ma una funzione del genere mi fa venire voglia di passare subito a NH3, ancor prima
che venga rilasciata la GA. 
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=87e2e085-8f21-4ec3-ba92-972d5456959b" />
      </body>
      <title>Interessante:ToRowCountQuery</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,87e2e085-8f21-4ec3-ba92-972d5456959b.aspx</guid>
      <link>http://www.felicepollano.com/2010/07/14/InteressanteToRowCountQuery.aspx</link>
      <pubDate>Wed, 14 Jul 2010 07:50:20 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
Apprendo da questo &lt;a href="http://fabiomaulo.blogspot.com/2010/07/enhanced-query-object.html" target="_blank"&gt;post&lt;/a&gt; di &lt;a href="http://fabiomaulo.blogspot.com/" target="_blank"&gt;Fabio
Maulo&lt;/a&gt; una interessante feature di &lt;a href="http://nhforge.org" target="_blank"&gt;NHibernate&lt;/a&gt; 3
implementata nel nuovo subset di API: &lt;a href="http://nhforge.org/blogs/nhibernate/archive/2009/12/17/queryover-in-nh-3-0.aspx" target="_blank"&gt;QueryOver&lt;/a&gt;.
Il post di Fabio approfondisce il pattern Query Object, e quello che salta all’occhio
è la pulizia con cui si riesca finalmemte a farte un paging “ad arte”. Per fare l’accesso
paginato in generale occorre avere il count delle righe che il sistema vorrebbe tornarci,
e questo constringeva in passato a fare delle implementazioni un po’ sporche in cui
si era costretti a specificare la query di selezione e quella di count. QueryOver
propone la funzione &lt;strong&gt;&lt;em&gt;query.ToRowCountQuery();&lt;/em&gt;&lt;/strong&gt; – dove query
è appunto una query di QueryOver, e la funzione ci restituisce la query di conteggio
in modo pulito e trasparente. Assolutamente molto utile. Io non sono uno da trunk,
ma una funzione del genere mi fa venire voglia di passare subito a NH3, ancor prima
che venga rilasciata la GA. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=87e2e085-8f21-4ec3-ba92-972d5456959b" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,87e2e085-8f21-4ec3-ba92-972d5456959b.aspx</comments>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=d02c0f1b-08ab-421e-9fdf-9310a77ad372</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,d02c0f1b-08ab-421e-9fdf-9310a77ad372.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,d02c0f1b-08ab-421e-9fdf-9310a77ad372.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=d02c0f1b-08ab-421e-9fdf-9310a77ad372</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbenchBugsandfeaturerequest_F68F/bug_2.jpg">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="bug" border="0" alt="bug" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbenchBugsandfeaturerequest_F68F/bug_thumb.jpg" width="139" height="165" />
          </a> The
right place for bug reporting or requiring additional features is <a href="http://sourceforge.net/tracker/?group_id=311514" target="_blank"></a></p>
        <h3>
          <a href="http://sourceforge.net/tracker/?group_id=311514" target="_blank">here</a>
        </h3>
        <p>
Since the project is new, it is normal to have something to fix. The problem is that
my testing would just be not sufficient, so your help will really be appreciated.
Thanks!
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=d02c0f1b-08ab-421e-9fdf-9310a77ad372" />
      </body>
      <title>NHibernate Workbench: Bugs and feature requests</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,d02c0f1b-08ab-421e-9fdf-9310a77ad372.aspx</guid>
      <link>http://www.felicepollano.com/2010/06/14/NHibernateWorkbenchBugsAndFeatureRequests.aspx</link>
      <pubDate>Mon, 14 Jun 2010 15:31:59 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbenchBugsandfeaturerequest_F68F/bug_2.jpg"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="bug" border="0" alt="bug" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbenchBugsandfeaturerequest_F68F/bug_thumb.jpg" width="139" height="165"&gt;&lt;/a&gt; The
right place for bug reporting or requiring additional features is &lt;a href="http://sourceforge.net/tracker/?group_id=311514" target="_blank"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;h3&gt;&lt;a href="http://sourceforge.net/tracker/?group_id=311514" target="_blank"&gt;here&lt;/a&gt;
&lt;/h3&gt;
&lt;p&gt;
Since the project is new, it is normal to have something to fix. The problem is that
my testing would just be not sufficient, so your help will really be appreciated.
Thanks!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=d02c0f1b-08ab-421e-9fdf-9310a77ad372" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,d02c0f1b-08ab-421e-9fdf-9310a77ad372.aspx</comments>
      <category>Code GEneration</category>
      <category>NHibernate</category>
      <category>NHWorkBench</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=c27ce306-4df7-419d-9c5f-25601af5e3ae</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,c27ce306-4df7-419d-9c5f-25601af5e3ae.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,c27ce306-4df7-419d-9c5f-25601af5e3ae.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c27ce306-4df7-419d-9c5f-25601af5e3ae</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
With a little delay <a href="http://nhforge.org/wikis/howtonh/how-to-use-db2hbm/comments.aspx?PageIndex=1" target="_blank">I
found people complaining about the schema file missing</a> from the <a href="http://nhforge.org/media/p/615.aspx" target="_blank">db2hbm</a> deployed
package. Now the file is included in the <a href="http://nhforge.org/media/p/615.aspx" target="_blank">download
package</a>, and <a href="http://nhforge.org/members/yanch/default.aspx" target="_blank">yanch</a> provided
a <a href="http://nhforge.org/wikis/howtonh/how-to-use-db2hbm.aspx" target="_blank">shortcut
in the doc</a> to <a href="https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Tool.hbm2net/src/NHibernate.Tool.Db2hbm/" target="_blank">download
the file from sourceforge</a>. Thanks! 
</p>
        <p align="justify">
Well, a few word about db2hbm and Oracle ( and any other database but MSSQL now ).
I used the schema information provided by NH as long as possible, but these information
does not provides the required details in order to discover completely the foreign
keys, and foreign keys are necessary for creating associations. Not really an NH problem,
actually NH leverages ADO.NET for schema inquiry, but ADO.NET seems to miss the foreign
key part. So the only solution to have db2hbm working for all database is to provide
a <a href="https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Tool.hbm2net/src/NHibernate.Tool.Db2hbm/IForeignKeyCrawler.cs" target="_blank">custom
foreign key crawler</a> for the DB.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=c27ce306-4df7-419d-9c5f-25601af5e3ae" />
      </body>
      <title>DB2HBM missing XSD file</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,c27ce306-4df7-419d-9c5f-25601af5e3ae.aspx</guid>
      <link>http://www.felicepollano.com/2010/06/05/DB2HBMMissingXSDFile.aspx</link>
      <pubDate>Sat, 05 Jun 2010 13:32:40 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
With a little delay &lt;a href="http://nhforge.org/wikis/howtonh/how-to-use-db2hbm/comments.aspx?PageIndex=1" target="_blank"&gt;I
found people complaining about the schema file missing&lt;/a&gt; from the &lt;a href="http://nhforge.org/media/p/615.aspx" target="_blank"&gt;db2hbm&lt;/a&gt; deployed
package. Now the file is included in the &lt;a href="http://nhforge.org/media/p/615.aspx" target="_blank"&gt;download
package&lt;/a&gt;, and &lt;a href="http://nhforge.org/members/yanch/default.aspx" target="_blank"&gt;yanch&lt;/a&gt; provided
a &lt;a href="http://nhforge.org/wikis/howtonh/how-to-use-db2hbm.aspx" target="_blank"&gt;shortcut
in the doc&lt;/a&gt; to &lt;a href="https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Tool.hbm2net/src/NHibernate.Tool.Db2hbm/" target="_blank"&gt;download
the file from sourceforge&lt;/a&gt;. Thanks! 
&lt;/p&gt;
&lt;p align="justify"&gt;
Well, a few word about db2hbm and Oracle ( and any other database but MSSQL now ).
I used the schema information provided by NH as long as possible, but these information
does not provides the required details in order to discover completely the foreign
keys, and foreign keys are necessary for creating associations. Not really an NH problem,
actually NH leverages ADO.NET for schema inquiry, but ADO.NET seems to miss the foreign
key part. So the only solution to have db2hbm working for all database is to provide
a &lt;a href="https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib/trunk/src/NHibernate.Tool.hbm2net/src/NHibernate.Tool.Db2hbm/IForeignKeyCrawler.cs" target="_blank"&gt;custom
foreign key crawler&lt;/a&gt; for the DB.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=c27ce306-4df7-419d-9c5f-25601af5e3ae" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,c27ce306-4df7-419d-9c5f-25601af5e3ae.aspx</comments>
      <category>Code GEneration</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=32f5a414-36eb-4ab5-a652-cc3add9c31f8</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,32f5a414-36eb-4ab5-a652-cc3add9c31f8.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,32f5a414-36eb-4ab5-a652-cc3add9c31f8.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=32f5a414-36eb-4ab5-a652-cc3add9c31f8</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
First of all I renamed the project on <a href="http://www.sourceforge.net" target="_blank">Sourceforge</a>.
Now it is more sensible <a href="http://sourceforge.net/projects/faticalabshqled/" target="_blank">NHibernate
Workbench</a>.
</p>
        <p>
          <a href="http://sourceforge.net/projects/faticalabshqled/" target="_blank">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="nhwsourceforge" border="0" alt="nhwsourceforge" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbenchnextsteps_B047/nhwsourceforge_3.png" width="630" height="262" />
          </a>
        </p>
        <p align="justify">
In the SVN repository there is now a tag to the version 1.0.0.11, and the trunk claim
to be the version 1.0.0.2.00.
</p>
        <p align="justify">
Now I’m planning to allow to use NH Workbench attached to a running application: this
should help us to play with application compiled without mappings ( ie <a href="http://code.google.com/p/codeconform/" target="_blank">ConfOrm</a> and <a href="http://fluentnhibernate.org/" target="_blank">Fluent
NH</a> ). Then I would like to improve the “Probe” class letting it be more versatile
and modifiable by the user, probably using some sort of script engine: I’m thinking
to use <a href="http://ironpython.net/" target="_blank">IronPython</a>, but any suggestion
are welcome. Just to clarify: the probe class serves to insolate NHWorkbench from
the NH version used by the project under test. We basically runs the test in a separate
app domain, but we need the “probe” type to be unbounded to any NH specific version.
This is done by using reflection, but it would be easier to be done in a script. The
same engine will be useful to write some NHibernate testing: instead of use just HQL,
we will be able to submit some portion of code on the fly and see what happen. The
other step is to allow the user writing a mapping on the fly and imemdiately see what
happen ( by using <a href="http://nhforge.org/media/p/546.aspx" target="_blank">hbm2net</a> behind
the scenes ). Ok, it’s a lot of work, I’ve no idea the order this will be done, let
me know if you have any idea and preference. 
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=32f5a414-36eb-4ab5-a652-cc3add9c31f8" />
      </body>
      <title>NHibernate Workbench next steps</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,32f5a414-36eb-4ab5-a652-cc3add9c31f8.aspx</guid>
      <link>http://www.felicepollano.com/2010/05/31/NHibernateWorkbenchNextSteps.aspx</link>
      <pubDate>Mon, 31 May 2010 10:35:43 GMT</pubDate>
      <description>&lt;p&gt;
First of all I renamed the project on &lt;a href="http://www.sourceforge.net" target="_blank"&gt;Sourceforge&lt;/a&gt;.
Now it is more sensible &lt;a href="http://sourceforge.net/projects/faticalabshqled/" target="_blank"&gt;NHibernate
Workbench&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sourceforge.net/projects/faticalabshqled/" target="_blank"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="nhwsourceforge" border="0" alt="nhwsourceforge" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbenchnextsteps_B047/nhwsourceforge_3.png" width="630" height="262"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
In the SVN repository there is now a tag to the version 1.0.0.11, and the trunk claim
to be the version 1.0.0.2.00.
&lt;/p&gt;
&lt;p align="justify"&gt;
Now I’m planning to allow to use NH Workbench attached to a running application: this
should help us to play with application compiled without mappings ( ie &lt;a href="http://code.google.com/p/codeconform/" target="_blank"&gt;ConfOrm&lt;/a&gt; and &lt;a href="http://fluentnhibernate.org/" target="_blank"&gt;Fluent
NH&lt;/a&gt; ). Then I would like to improve the “Probe” class letting it be more versatile
and modifiable by the user, probably using some sort of script engine: I’m thinking
to use &lt;a href="http://ironpython.net/" target="_blank"&gt;IronPython&lt;/a&gt;, but any suggestion
are welcome. Just to clarify: the probe class serves to insolate NHWorkbench from
the NH version used by the project under test. We basically runs the test in a separate
app domain, but we need the “probe” type to be unbounded to any NH specific version.
This is done by using reflection, but it would be easier to be done in a script. The
same engine will be useful to write some NHibernate testing: instead of use just HQL,
we will be able to submit some portion of code on the fly and see what happen. The
other step is to allow the user writing a mapping on the fly and imemdiately see what
happen ( by using &lt;a href="http://nhforge.org/media/p/546.aspx" target="_blank"&gt;hbm2net&lt;/a&gt; behind
the scenes ). Ok, it’s a lot of work, I’ve no idea the order this will be done, let
me know if you have any idea and preference. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=32f5a414-36eb-4ab5-a652-cc3add9c31f8" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,32f5a414-36eb-4ab5-a652-cc3add9c31f8.aspx</comments>
      <category>Code GEneration</category>
      <category>HQL Intellisense</category>
      <category>NHibernate</category>
      <category>NHWorkBench</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=16e3b3d6-d315-4e96-b274-e5d7d4eee261</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,16e3b3d6-d315-4e96-b274-e5d7d4eee261.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,16e3b3d6-d315-4e96-b274-e5d7d4eee261.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=16e3b3d6-d315-4e96-b274-e5d7d4eee261</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
Sometimes I receive some notification on where source code for both <a href="http://nhforge.org/media/p/615.aspx" target="_blank">db2hbm</a> and <a href="hhttp://nhforge.org/media/p/546.aspx" target="_blank">hbm2net</a> are
located. The best way is to check-out the source of the <a href="https://sourceforge.net/projects/nhcontrib/" target="_blank">NHContrib</a> project: <code><strong><em><a href="https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib">https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib</a></em></strong></code></p>
        <p align="justify">
hbm2net is still in alfa, but I frequently use it in my projects as a class generator.
It really lack some documentation: it is really a powerful artifact generator, and
by writing proper T4 templates any artifact can be generated. Db2hbm is working ok
for MSSQL, but there is not yet an implementation for oracle and other DB, even if
Ricardo Peres provided me some interesting code to work on. 
</p>
        <p align="justify">
Hope this help who’s looking for these tools source code.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=16e3b3d6-d315-4e96-b274-e5d7d4eee261" />
      </body>
      <title>Hbm2net and Db2hbm source code location</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,16e3b3d6-d315-4e96-b274-e5d7d4eee261.aspx</guid>
      <link>http://www.felicepollano.com/2010/05/24/Hbm2netAndDb2hbmSourceCodeLocation.aspx</link>
      <pubDate>Mon, 24 May 2010 19:08:30 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
Sometimes I receive some notification on where source code for both &lt;a href="http://nhforge.org/media/p/615.aspx" target="_blank"&gt;db2hbm&lt;/a&gt; and &lt;a href="hhttp://nhforge.org/media/p/546.aspx" target="_blank"&gt;hbm2net&lt;/a&gt; are
located. The best way is to check-out the source of the &lt;a href="https://sourceforge.net/projects/nhcontrib/" target="_blank"&gt;NHContrib&lt;/a&gt; project: &lt;code&gt;&lt;strong&gt;&lt;em&gt;&lt;a href="https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib"&gt;https://nhcontrib.svn.sourceforge.net/svnroot/nhcontrib&lt;/a&gt;&lt;/em&gt;&lt;/strong&gt; &lt;/code&gt;
&lt;/p&gt;
&lt;p align="justify"&gt;
hbm2net is still in alfa, but I frequently use it in my projects as a class generator.
It really lack some documentation: it is really a powerful artifact generator, and
by writing proper T4 templates any artifact can be generated. Db2hbm is working ok
for MSSQL, but there is not yet an implementation for oracle and other DB, even if
Ricardo Peres provided me some interesting code to work on. 
&lt;/p&gt;
&lt;p align="justify"&gt;
Hope this help who’s looking for these tools source code.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=16e3b3d6-d315-4e96-b274-e5d7d4eee261" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,16e3b3d6-d315-4e96-b274-e5d7d4eee261.aspx</comments>
      <category>Code GEneration</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=9aad49f3-3a61-4dc5-98a9-3f90acc16e5a</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,9aad49f3-3a61-4dc5-98a9-3f90acc16e5a.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,9aad49f3-3a61-4dc5-98a9-3f90acc16e5a.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=9aad49f3-3a61-4dc5-98a9-3f90acc16e5a</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
Just looking around for some related <a href="http://nhforge.org" target="_blank">NHibernate</a> projects,
I <a href="http://nhtrace.codeplex.com/" target="_blank">found this open source profiler</a>.
For people who start to use NHibernate and before to buy something more accurate as <a href="http://nhprof.com/" target="_blank">NHProf</a>,
it is really useful having a log easy to read to discover performance or bad usage
issues. 
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=9aad49f3-3a61-4dc5-98a9-3f90acc16e5a" />
      </body>
      <title>Some more tools for NH</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,9aad49f3-3a61-4dc5-98a9-3f90acc16e5a.aspx</guid>
      <link>http://www.felicepollano.com/2010/05/22/SomeMoreToolsForNH.aspx</link>
      <pubDate>Sat, 22 May 2010 20:27:01 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
Just looking around for some related &lt;a href="http://nhforge.org" target="_blank"&gt;NHibernate&lt;/a&gt; projects,
I &lt;a href="http://nhtrace.codeplex.com/" target="_blank"&gt;found this open source profiler&lt;/a&gt;.
For people who start to use NHibernate and before to buy something more accurate as &lt;a href="http://nhprof.com/" target="_blank"&gt;NHProf&lt;/a&gt;,
it is really useful having a log easy to read to discover performance or bad usage
issues. 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=9aad49f3-3a61-4dc5-98a9-3f90acc16e5a" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,9aad49f3-3a61-4dc5-98a9-3f90acc16e5a.aspx</comments>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=5cbb4eec-6069-4c97-9617-acac3f34d911</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,5cbb4eec-6069-4c97-9617-acac3f34d911.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,5cbb4eec-6069-4c97-9617-acac3f34d911.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5cbb4eec-6069-4c97-9617-acac3f34d911</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
As you probably guess, the Fatica.Labs.HqlEditor evolved as a component used by <a href="http://www.felicepollano.com/2010/05/19/NHibernateWorkbench.aspx">NH
Workbench</a>, that is basically a tool ispired by the <a href="http://www.ayende.com/projects/nhibernate-query-analyzer.aspx">old
and wise NHQA</a> by <a href="http://www.ayende.com/">Ayende</a>. There is, in comparison,
some new ideas and some missing required functions. Anyway I decided to publish a
first drop because it already help me on my day job. If you find the project useful
please consider visits the following links:
</p>
        <ul>
          <li>
            <div align="justify">
              <a href="https://sourceforge.net/projects/faticalabshqled/" target="_blank">The
SourceForge project location</a>
            </div>
          </li>
          <li>
            <div align="justify">
              <a href="https://sourceforge.net/tracker/?group_id=311514" target="_blank">The
SourceForge forum to submit bugs and feature requests</a>
            </div>
          </li>
          <li>
            <div align="justify">
              <a href="https://sourceforge.net/projects/faticalabshqled/files/" target="_blank">The
last release download location</a>
            </div>
          </li>
          <li>
            <div align="justify">
              <a href="http://www.felicepollano.com" target="_blank">This site
for staying tuned</a> ;)
</div>
          </li>
        </ul>
        <p align="justify">
And, if you want to join the project, please <a href="mailto://felice_at_felicepollanodotcom" target="_blank">let
me know</a>.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=5cbb4eec-6069-4c97-9617-acac3f34d911" />
      </body>
      <title>Fatica.Labs.HqlEditor-&gt;NH Workbench</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,5cbb4eec-6069-4c97-9617-acac3f34d911.aspx</guid>
      <link>http://www.felicepollano.com/2010/05/22/FaticaLabsHqlEditorNHWorkbench.aspx</link>
      <pubDate>Sat, 22 May 2010 05:55:49 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
As you probably guess, the Fatica.Labs.HqlEditor evolved as a component used by &lt;a href="http://www.felicepollano.com/2010/05/19/NHibernateWorkbench.aspx"&gt;NH
Workbench&lt;/a&gt;, that is basically a tool ispired by the &lt;a href="http://www.ayende.com/projects/nhibernate-query-analyzer.aspx"&gt;old
and wise NHQA&lt;/a&gt; by &lt;a href="http://www.ayende.com/"&gt;Ayende&lt;/a&gt;. There is, in comparison,
some new ideas and some missing required functions. Anyway I decided to publish a
first drop because it already help me on my day job. If you find the project useful
please consider visits the following links:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="https://sourceforge.net/projects/faticalabshqled/" target="_blank"&gt;The
SourceForge project location&lt;/a&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="https://sourceforge.net/tracker/?group_id=311514" target="_blank"&gt;The
SourceForge forum to submit bugs and feature requests&lt;/a&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="https://sourceforge.net/projects/faticalabshqled/files/" target="_blank"&gt;The
last release download location&lt;/a&gt;
&lt;/div&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;div align="justify"&gt;&lt;a href="http://www.felicepollano.com" target="_blank"&gt;This site
for staying tuned&lt;/a&gt; ;)
&lt;/div&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;p align="justify"&gt;
And, if you want to join the project, please &lt;a href="mailto://felice_at_felicepollanodotcom" target="_blank"&gt;let
me know&lt;/a&gt;.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=5cbb4eec-6069-4c97-9617-acac3f34d911" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,5cbb4eec-6069-4c97-9617-acac3f34d911.aspx</comments>
      <category>HQL Intellisense</category>
      <category>NHibernate</category>
      <category>NHWorkBench</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=5afc1727-7cc5-4248-9695-69047cfcc138</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,5afc1727-7cc5-4248-9695-69047cfcc138.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,5afc1727-7cc5-4248-9695-69047cfcc138.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=5afc1727-7cc5-4248-9695-69047cfcc138</wfw:commentRss>
      <slash:comments>10</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
In the spirit of “<em>Release early. Release often. And listen to your customers</em>”
( cit. ), even if not so early in term of time since the <a href="http://www.felicepollano.com/2010/04/22/SomeProgressWithHqlIntellisense.aspx">preview</a>,
I decided to <a href="http://sourceforge.net/projects/faticalabshqled/files/">release
a first drop</a> of the “HQL Intellisense thing” I’m working on. The current version
is just able to load an existing mapping assembly, a configuration, help us to write
an hql query, submit it to NH and see some results. Here an overall screenshot: 
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s1_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s1" border="0" alt="s1" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s1_thumb.png" width="580" height="407" />
          </a>
        </p>
        <p align="justify">
To use it you need to <a href="http://sourceforge.net/projects/faticalabshqled/files/" target="_blank">download
the bits</a>, and then “create a project” a project is, in the NH Workbench world,
a bounch of file representing what we are working on ( and actually is a project in
the MSBUILD world. To use the tool now we need at least a working NH configuration
file ( your app.config or web config ) and one or more mapping assembly(ies). You
add the files to the project by right clicking the project tree:<a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s2_2.png"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="s2" border="0" alt="s2" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s2_thumb.png" width="202" height="244" /></a></p>
        <p align="justify">
After you added the file you can save the project, so it can be reopened when needed.
Please note that the mapping assembly has to be opened from a location containing
all the required dependencies ( usually the application folder, or the bin folder
).
</p>
        <p align="justify">
After the project is created, you need to compile it before starting to write the
queries:
</p>
        <p align="justify">
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s3_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="s3" border="0" alt="s3" align="right" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s3_thumb.png" width="244" height="79" />
          </a>
        </p>
        <p>
You can compile the project by clicking the button on the toolbar as shown in the
picture Fig3
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
Compiling the project should produce a report in the log area:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s4_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s4" border="0" alt="s4" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s4_thumb.png" width="572" height="142" />
          </a>
        </p>
        <p>
If you find the report too verbose, you can uncheck some of the button in the log
toolbar. After a successful compilation, we can open a query (hql) document:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s5_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="s5" border="0" alt="s5" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s5_thumb.png" width="244" height="256" />
          </a>
        </p>
        <p>
        </p>
        <p>
This will open a pane in the document area in which we can write HQL queries with
some intellisense/auto-completion. Plaese note that, for have the entity completion,
after the “from” keyword we need to <strong>press ctrl+space</strong> to see the completion
combo.
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s6_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="s6" border="0" alt="s6" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s6_thumb.png" width="244" height="64" />
          </a>
        </p>
        <p>
Here an example HQL document. After a valid query is done we can submit it to NH and
see the result:
</p>
        <p>
 
</p>
        <p>
The “<strong>play</strong>” button is enabled only if a valid query ( no errors )
is written in the document. The<strong> first</strong> and <strong>coun</strong>t
places are useful to<strong> limit</strong> the query results.
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s7_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s7" border="0" alt="s7" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s7_thumb.png" width="213" height="80" />
          </a> By
pressing the play button, you will be able to se the query results ( if any ):
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s8_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s8" border="0" alt="s8" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s8_thumb.png" width="482" height="147" />
          </a>
        </p>
        <p>
Next steps:
</p>
        <ul>
          <li>
Solve the bugs till now 
</li>
          <li>
Add supports for <a href="http://nhforge.org/media/p/546.aspx" target="_blank">hbm2net</a>,
so user can write mapping and immediately see it at works. 
</li>
        </ul>
        <p>
Enjoy !
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=5afc1727-7cc5-4248-9695-69047cfcc138" />
      </body>
      <title>NHibernate Workbench</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,5afc1727-7cc5-4248-9695-69047cfcc138.aspx</guid>
      <link>http://www.felicepollano.com/2010/05/19/NHibernateWorkbench.aspx</link>
      <pubDate>Wed, 19 May 2010 15:30:52 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
In the spirit of “&lt;em&gt;Release early. Release often. And listen to your customers&lt;/em&gt;”
( cit. ), even if not so early in term of time since the &lt;a href="http://www.felicepollano.com/2010/04/22/SomeProgressWithHqlIntellisense.aspx"&gt;preview&lt;/a&gt;,
I decided to &lt;a href="http://sourceforge.net/projects/faticalabshqled/files/"&gt;release
a first drop&lt;/a&gt; of the “HQL Intellisense thing” I’m working on. The current version
is just able to load an existing mapping assembly, a configuration, help us to write
an hql query, submit it to NH and see some results. Here an overall screenshot: 
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s1_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s1" border="0" alt="s1" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s1_thumb.png" width="580" height="407"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p align="justify"&gt;
To use it you need to &lt;a href="http://sourceforge.net/projects/faticalabshqled/files/" target="_blank"&gt;download
the bits&lt;/a&gt;, and then “create a project” a project is, in the NH Workbench world,
a bounch of file representing what we are working on ( and actually is a project in
the MSBUILD world. To use the tool now we need at least a working NH configuration
file ( your app.config or web config ) and one or more mapping assembly(ies). You
add the files to the project by right clicking the project tree:&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s2_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="s2" border="0" alt="s2" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s2_thumb.png" width="202" height="244"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p align="justify"&gt;
After you added the file you can save the project, so it can be reopened when needed.
Please note that the mapping assembly has to be opened from a location containing
all the required dependencies ( usually the application folder, or the bin folder
).
&lt;/p&gt;
&lt;p align="justify"&gt;
After the project is created, you need to compile it before starting to write the
queries:
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s3_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="s3" border="0" alt="s3" align="right" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s3_thumb.png" width="244" height="79"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
You can compile the project by clicking the button on the toolbar as shown in the
picture Fig3
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Compiling the project should produce a report in the log area:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s4_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s4" border="0" alt="s4" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s4_thumb.png" width="572" height="142"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
If you find the report too verbose, you can uncheck some of the button in the log
toolbar. After a successful compilation, we can open a query (hql) document:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s5_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="s5" border="0" alt="s5" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s5_thumb.png" width="244" height="256"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
This will open a pane in the document area in which we can write HQL queries with
some intellisense/auto-completion. Plaese note that, for have the entity completion,
after the “from” keyword we need to &lt;strong&gt;press ctrl+space&lt;/strong&gt; to see the completion
combo.
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s6_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; margin-left: 0px; border-left-width: 0px; margin-right: 0px" title="s6" border="0" alt="s6" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s6_thumb.png" width="244" height="64"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Here an example HQL document. After a valid query is done we can submit it to NH and
see the result:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
The “&lt;strong&gt;play&lt;/strong&gt;” button is enabled only if a valid query ( no errors )
is written in the document. The&lt;strong&gt; first&lt;/strong&gt; and &lt;strong&gt;coun&lt;/strong&gt;t
places are useful to&lt;strong&gt; limit&lt;/strong&gt; the query results.
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s7_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s7" border="0" alt="s7" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s7_thumb.png" width="213" height="80"&gt;&lt;/a&gt; By
pressing the play button, you will be able to se the query results ( if any ):
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s8_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s8" border="0" alt="s8" src="http://www.felicepollano.com/public/WindowsLiveWriter/NHibernateWorkbench_F09B/s8_thumb.png" width="482" height="147"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Next steps:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Solve the bugs till now 
&lt;li&gt;
Add supports for &lt;a href="http://nhforge.org/media/p/546.aspx" target="_blank"&gt;hbm2net&lt;/a&gt;,
so user can write mapping and immediately see it at works. 
&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Enjoy !
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=5afc1727-7cc5-4248-9695-69047cfcc138" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,5afc1727-7cc5-4248-9695-69047cfcc138.aspx</comments>
      <category>Code GEneration</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=87600944-58a9-477e-9985-9885d8337769</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,87600944-58a9-477e-9985-9885d8337769.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,87600944-58a9-477e-9985-9885d8337769.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=87600944-58a9-477e-9985-9885d8337769</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
There was a bug in the many-to-many strategy, causing a null reference exception.
The bug was solved, and a current snapshot of db2hbm can be <a href="http://nhforge.org/media/p/615.aspx" target="_blank">found
here as usual</a>.
</p>
        <p align="justify">
          <a href="http://nhforge.org/media/p/615.aspx">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="db2hbm" border="0" alt="db2hbm" src="http://www.felicepollano.com/public/WindowsLiveWriter/Db2hbmbugsolved_9DE8/db2hbm_3.png" width="414" height="98" />
          </a>
        </p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=87600944-58a9-477e-9985-9885d8337769" />
      </body>
      <title>Db2hbm: bug solved</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,87600944-58a9-477e-9985-9885d8337769.aspx</guid>
      <link>http://www.felicepollano.com/2010/05/19/Db2hbmBugSolved.aspx</link>
      <pubDate>Wed, 19 May 2010 09:13:46 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
There was a bug in the many-to-many strategy, causing a null reference exception.
The bug was solved, and a current snapshot of db2hbm can be &lt;a href="http://nhforge.org/media/p/615.aspx" target="_blank"&gt;found
here as usual&lt;/a&gt;.
&lt;/p&gt;
&lt;p align="justify"&gt;
&lt;a href="http://nhforge.org/media/p/615.aspx"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="db2hbm" border="0" alt="db2hbm" src="http://www.felicepollano.com/public/WindowsLiveWriter/Db2hbmbugsolved_9DE8/db2hbm_3.png" width="414" height="98"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=87600944-58a9-477e-9985-9885d8337769" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,87600944-58a9-477e-9985-9885d8337769.aspx</comments>
      <category>Code GEneration</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=e67b92fb-d004-419f-9d95-713f96a27a00</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,e67b92fb-d004-419f-9d95-713f96a27a00.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,e67b92fb-d004-419f-9d95-713f96a27a00.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=e67b92fb-d004-419f-9d95-713f96a27a00</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://twtpoll.com/r/9o74or" target="_blank">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://www.felicepollano.com/public/WindowsLiveWriter/SondaggioNH3.0_7D01/clip_image001_3.png" width="542" height="115" />
          </a>
        </p>
        <p>
  
</p>
        <p>
          <a href="http://fabiomaulo.blogspot.com/" target="_blank">Fabio Maulo</a> propone
un sondaggio per la versione di NH in uscita. Dovrà compilare su Fx <strong>3.5</strong> o <strong>4.0</strong> ? 
</p>
        <p>
Personalmente preferirei ancora un uscita in 3.5. <a href="http://twtpoll.com/r/9o74or" target="_blank">Votate</a>! <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=e67b92fb-d004-419f-9d95-713f96a27a00" /></p>
      </body>
      <title>Sondaggio NH 3.0</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,e67b92fb-d004-419f-9d95-713f96a27a00.aspx</guid>
      <link>http://www.felicepollano.com/2010/05/13/SondaggioNH30.aspx</link>
      <pubDate>Thu, 13 May 2010 06:53:23 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://twtpoll.com/r/9o74or" target="_blank"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="clip_image001" border="0" alt="clip_image001" src="http://www.felicepollano.com/public/WindowsLiveWriter/SondaggioNH3.0_7D01/clip_image001_3.png" width="542" height="115"&gt;&lt;/a&gt; 
&lt;p&gt;
&amp;nbsp; 
&lt;p&gt;
&lt;a href="http://fabiomaulo.blogspot.com/" target="_blank"&gt;Fabio Maulo&lt;/a&gt; propone
un sondaggio per la versione di NH in uscita. Dovrà compilare su Fx &lt;strong&gt;3.5&lt;/strong&gt; o &lt;strong&gt;4.0&lt;/strong&gt; ? 
&lt;p&gt;
Personalmente preferirei ancora un uscita in 3.5. &lt;a href="http://twtpoll.com/r/9o74or" target="_blank"&gt;Votate&lt;/a&gt;! &lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=e67b92fb-d004-419f-9d95-713f96a27a00" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,e67b92fb-d004-419f-9d95-713f96a27a00.aspx</comments>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=636aa68e-1f22-49cf-93ac-35df305ce24b</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,636aa68e-1f22-49cf-93ac-35df305ce24b.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,636aa68e-1f22-49cf-93ac-35df305ce24b.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=636aa68e-1f22-49cf-93ac-35df305ce24b</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/HqlEditorqueryresults_FCA9/s9c_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="s9c" border="0" alt="s9c" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/HqlEditorqueryresults_FCA9/s9c_thumb.png" width="240" height="236" />
          </a>There
is some interesting news with HqlEditor: now it is able to translate the query using
the proper parser ( Antlr or Classic ) depending on the NH version used to build the
assembly in test. An error message is shown when the syntax is parsed as invalid. 
</p>
        <p>
        </p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
 
</p>
        <p>
          <strong>A first table containing the entities is present too, here below a screenshot</strong>:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/HqlEditorqueryresults_FCA9/s10a_2.png">
            <img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="s10a" border="0" alt="s10a" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/HqlEditorqueryresults_FCA9/s10a_thumb.png" width="396" height="207" />
          </a>
        </p>
        <p>
As you can probably notice, the data grid is not a real grid. This is because is not
so easy to present an NH graph without converting it in some sort of DTO, but I don’t
want to add anything but the query process itself. So I decided to use a sort of JSON
serializer to present each object in a textual fashion. In the toolbar there is the
query limit too: this act by adding a <strong>SetFirstResult(),</strong><strong>SetMaxResults()</strong> function
call in the query creation. Using a<strong> count=0</strong> forces the system to
avoid limiting the query: if the data you retrieve is a big bounch you will probably
experience some delay, but should be useful in the case the driver does not support
limits.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=636aa68e-1f22-49cf-93ac-35df305ce24b" />
      </body>
      <title>HqlEditor: query results</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,636aa68e-1f22-49cf-93ac-35df305ce24b.aspx</guid>
      <link>http://www.felicepollano.com/2010/04/29/HqlEditorQueryResults.aspx</link>
      <pubDate>Thu, 29 Apr 2010 16:09:29 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/HqlEditorqueryresults_FCA9/s9c_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="s9c" border="0" alt="s9c" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/HqlEditorqueryresults_FCA9/s9c_thumb.png" width="240" height="236"&gt;&lt;/a&gt;There
is some interesting news with HqlEditor: now it is able to translate the query using
the proper parser ( Antlr or Classic ) depending on the NH version used to build the
assembly in test. An error message is shown when the syntax is parsed as invalid. 
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;strong&gt;A first table containing the entities is present too, here below a screenshot&lt;/strong&gt;:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/HqlEditorqueryresults_FCA9/s10a_2.png"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; margin-left: 0px; border-top: 0px; margin-right: 0px; border-right: 0px" title="s10a" border="0" alt="s10a" align="left" src="http://www.felicepollano.com/public/WindowsLiveWriter/HqlEditorqueryresults_FCA9/s10a_thumb.png" width="396" height="207"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
As you can probably notice, the data grid is not a real grid. This is because is not
so easy to present an NH graph without converting it in some sort of DTO, but I don’t
want to add anything but the query process itself. So I decided to use a sort of JSON
serializer to present each object in a textual fashion. In the toolbar there is the
query limit too: this act by adding a &lt;strong&gt;SetFirstResult(),&lt;/strong&gt; &lt;strong&gt;SetMaxResults()&lt;/strong&gt; function
call in the query creation. Using a&lt;strong&gt; count=0&lt;/strong&gt; forces the system to
avoid limiting the query: if the data you retrieve is a big bounch you will probably
experience some delay, but should be useful in the case the driver does not support
limits.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=636aa68e-1f22-49cf-93ac-35df305ce24b" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,636aa68e-1f22-49cf-93ac-35df305ce24b.aspx</comments>
      <category>HQL Intellisense</category>
      <category>NHibernate</category>
      <category>NHWorkBench</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=902148d9-a656-49cf-b864-b5bef54fb393</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,902148d9-a656-49cf-b864-b5bef54fb393.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,902148d9-a656-49cf-b864-b5bef54fb393.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=902148d9-a656-49cf-b864-b5bef54fb393</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Per abilitare il logging delle query con NHibernate occorre:
</p>
        <ol>
          <li>
Avere nella bin dell applicativo ( ie: nella <strong>/bin</strong> per le applicazioni
web, a fianco dell’ esequibile per le applicazioni stand-alone ) la dll di <a href="http://logging.apache.org/log4net/index.html" target="_blank">log4net</a>. 
</li>
          <li>
Aggiungere nel file di configurazione la sessione di config per log4net:</li>
        </ol>
        <p>
&lt;configuration&gt;<br />
  &lt;configSections&gt;<br />
    <strong>&lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,
log4net"/&gt;</strong></p>
        <p>
  &lt;/configSections&gt;<br />
  <strong>&lt;log4net&gt;</strong><br />
    &lt;appender name="console" type="log4net.Appender.ConsoleAppender"&gt;<br />
      &lt;layout type="log4net.Layout.PatternLayout"&gt;<br />
        &lt;param name="ConversionPattern" value="%-5p
- %m%n" /&gt;<br />
      &lt;/layout&gt;<br />
    &lt;/appender&gt;<br />
    <strong>&lt;logger name="NHibernate.SQL" additivity="false"&gt;<br />
      &lt;level value="ALL"/&gt;<br />
      &lt;appender-ref ref="console" /&gt;<br />
    &lt;/logger&gt;<br /></strong>    &lt;root&gt;<br />
      &lt;priority value="WARN" /&gt;<br />
      &lt;appender-ref ref="console" /&gt;<br />
    &lt;/root&gt;<br />
  <strong>&lt;/log4net&gt;<br /></strong>&lt;/configuration&gt; 
</p>
        <p>
Con questa configurazione si usa il console appender, per un’applicativo web potrebbe
essere meglio usare un <a href="http://logging.apache.org/log4net/release/config-examples.html" target="_blank">TraceAppender
o un altro appender di proprio gusto ;-)</a></p>
        <p>
  
</p>
        <li>
Assicurarsi di chiamare, almeno una voltanell’applicazione <strong>log4net.XmlConfigurator.Configure()</strong></li>
        <li>
Aggiungere questa proprietà nella configurazione di NH:                                         <strong>&lt;property
name="show_sql"&gt;true&lt;/property&gt;</strong></li>
        <h6>
        </h6>
        <h3>
          <em>
            <u>Se <b>NON</b> vogliamo mettere nulla di log4net nella configurazione</u>
          </em>:
</h3>
        <p>
Possiamo configurare log4net dall’ applicativo, con un paio di linee di codice:
</p>
        <div class="csharpcode">
          <pre class="alt">
            <span class="lnum"> 1: </span> TraceAppender
app = <span class="kwrd">new</span> TraceAppender();</pre>
          <pre>
            <span class="lnum"> 2: </span> app.Layout
= <span class="kwrd">new</span> SimpleLayout();</pre>
          <pre class="alt">
            <span class="lnum"> 3: </span> LoggerMatchFilter
filter = <span class="kwrd">new</span> LoggerMatchFilter();</pre>
          <pre>
            <span class="lnum"> 4: </span> filter.LoggerToMatch=<span class="str">"NHibernate.SQL"</span>;</pre>
          <pre class="alt">
            <span class="lnum"> 5: </span> filter.AcceptOnMatch
= <span class="kwrd">true</span>;</pre>
          <pre>
            <span class="lnum"> 6: </span> filter.ActivateOptions();</pre>
          <pre class="alt">
            <span class="lnum"> 7: </span> app.AddFilter(filter); <span class="rem">//
L'ordine di questo filtro</span></pre>
          <pre>
            <span class="lnum"> 8: </span> app.AddFilter(<span class="kwrd">new</span> DenyAllFilter()); <span class="rem">//
e di quest'altro E' importante</span></pre>
          <pre class="alt">
            <span class="lnum"> 9: </span> app.ActivateOptions();</pre>
          <pre>
            <span class="lnum"> 10: </span> BasicConfigurator.Configure(
app);</pre>
          <pre> </pre>
          <pre> </pre>
          <pre> </pre>
        </div>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <style type="text/css">.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
</style>
        <p>
In questo caso si possono saltare gli step da 1 a 3. Questo codice deve essere chiamato
una volta nell’applicazione in fase di startup, per un’applicazione web, potrebbe
andare bene l’evento di startup dell'applicazione in <b>global.asax</b>. Con l’appender
e i filtri configurati si ottiene nell'area trace di Visual Studio ( Output-tab Debug) 
l’output delle sole query generate da NH ( senza gli altri logger, se servono 
si possono togliere i filtri )
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=902148d9-a656-49cf-b864-b5bef54fb393" />
      </body>
      <title>Abilitare il logging delle query con NHibernate</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,902148d9-a656-49cf-b864-b5bef54fb393.aspx</guid>
      <link>http://www.felicepollano.com/2010/04/27/AbilitareIlLoggingDelleQueryConNHibernate.aspx</link>
      <pubDate>Tue, 27 Apr 2010 15:43:20 GMT</pubDate>
      <description>&lt;p&gt;
Per abilitare il logging delle query con NHibernate occorre:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
Avere nella bin dell applicativo ( ie: nella &lt;strong&gt;/bin&lt;/strong&gt; per le applicazioni
web, a fianco dell’ esequibile per le applicazioni stand-alone ) la dll di &lt;a href="http://logging.apache.org/log4net/index.html" target="_blank"&gt;log4net&lt;/a&gt;. 
&lt;/li&gt;
&lt;li&gt;
Aggiungere nel file di configurazione la sessione di config per log4net:&lt;/li&gt;
&lt;p&gt;
&amp;lt;configuration&amp;gt;&lt;br&gt;
&amp;nbsp; &amp;lt;configSections&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&amp;lt;section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,
log4net"/&amp;gt;&lt;/strong&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp; &amp;lt;/configSections&amp;gt;&lt;br&gt;
&amp;nbsp; &lt;strong&gt;&amp;lt;log4net&amp;gt;&lt;/strong&gt;
&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;appender name="console" type="log4net.Appender.ConsoleAppender"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;layout type="log4net.Layout.PatternLayout"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;param name="ConversionPattern" value="%-5p
- %m%n" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/layout&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/appender&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;strong&gt;&amp;lt;logger name="NHibernate.SQL" additivity="false"&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;level value="ALL"/&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;appender-ref ref="console" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/logger&amp;gt;&lt;br&gt;
&lt;/strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;root&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;priority value="WARN" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;appender-ref ref="console" /&amp;gt;&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;lt;/root&amp;gt;&lt;br&gt;
&amp;nbsp; &lt;strong&gt;&amp;lt;/log4net&amp;gt;&lt;br&gt;
&lt;/strong&gt;&amp;lt;/configuration&amp;gt; 
&lt;/p&gt;
&lt;p&gt;
Con questa configurazione si usa il console appender, per un’applicativo web potrebbe
essere meglio usare un &lt;a href="http://logging.apache.org/log4net/release/config-examples.html" target="_blank"&gt;TraceAppender
o un altro appender di proprio gusto ;-)&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp; 
&lt;/p&gt;
&lt;li&gt;
Assicurarsi di chiamare, almeno una voltanell’applicazione &lt;strong&gt;log4net.XmlConfigurator.Configure()&lt;/strong&gt;
&lt;/li&gt;
&lt;li&gt;
Aggiungere questa proprietà nella configurazione di NH:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&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;strong&gt;&amp;lt;property
name="show_sql"&amp;gt;true&amp;lt;/property&amp;gt;&lt;/strong&gt;
&lt;/li&gt;&gt;
&lt;h6&gt;
&lt;/h6&gt;
&lt;h3&gt;&lt;em&gt;&lt;u&gt;Se &lt;b&gt;NON&lt;/b&gt; vogliamo mettere nulla di log4net nella configurazione&lt;/u&gt;&lt;/em&gt;:
&lt;/h3&gt;
&lt;p&gt;
Possiamo configurare log4net dall’ applicativo, con un paio di linee di codice:
&lt;/p&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 1: &lt;/span&gt; TraceAppender
app = &lt;span class="kwrd"&gt;new&lt;/span&gt; TraceAppender();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt; 2: &lt;/span&gt; app.Layout
= &lt;span class="kwrd"&gt;new&lt;/span&gt; SimpleLayout();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 3: &lt;/span&gt; LoggerMatchFilter
filter = &lt;span class="kwrd"&gt;new&lt;/span&gt; LoggerMatchFilter();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt; 4: &lt;/span&gt; filter.LoggerToMatch=&lt;span class="str"&gt;"NHibernate.SQL"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 5: &lt;/span&gt; filter.AcceptOnMatch
= &lt;span class="kwrd"&gt;true&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt; 6: &lt;/span&gt; filter.ActivateOptions();&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 7: &lt;/span&gt; app.AddFilter(filter); &lt;span class="rem"&gt;//
L'ordine di questo filtro&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt; 8: &lt;/span&gt; app.AddFilter(&lt;span class="kwrd"&gt;new&lt;/span&gt; DenyAllFilter()); &lt;span class="rem"&gt;//
e di quest'altro E' importante&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt; 9: &lt;/span&gt; app.ActivateOptions();&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt; 10: &lt;/span&gt; BasicConfigurator.Configure(
app);&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;&lt;pre&gt;&amp;nbsp;&lt;/pre&gt;
&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;p&gt;
In questo caso si possono saltare gli step da 1 a 3. Questo codice deve essere chiamato
una volta nell’applicazione in fase di startup, per un’applicazione web, potrebbe
andare bene l’evento di startup dell'applicazione in &lt;b&gt;global.asax&lt;/b&gt;. Con l’appender
e i filtri configurati si ottiene nell'area trace di Visual Studio ( Output-tab Debug)&amp;nbsp;
l’output delle sole query generate da NH ( senza gli altri logger, se servono&amp;nbsp;
si possono togliere i filtri )
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=902148d9-a656-49cf-b864-b5bef54fb393" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,902148d9-a656-49cf-b864-b5bef54fb393.aspx</comments>
      <category>NHibernate</category>
      <category>log4net</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=60ee7985-45e2-4371-b632-7f12ecf1ed1e</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,60ee7985-45e2-4371-b632-7f12ecf1ed1e.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,60ee7985-45e2-4371-b632-7f12ecf1ed1e.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=60ee7985-45e2-4371-b632-7f12ecf1ed1e</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
          <a href="http://bugsquash.blogspot.com/" target="_blank">Mauricio Scheffer</a> has
just released a <a href="http://bugsquash.blogspot.com/2010/04/nhwebconsole-01-released.html" target="_blank">web
based console for editing HQL</a>. He based the intellisense on <a href="http://sourceforge.net/projects/faticalabshqled/" target="_blank">my
project</a>. I’m happy to see some of my effort reused somewhere! So thanks to Mauricio.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=60ee7985-45e2-4371-b632-7f12ecf1ed1e" />
      </body>
      <title>Hql Intellisense: a Web based console.</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,60ee7985-45e2-4371-b632-7f12ecf1ed1e.aspx</guid>
      <link>http://www.felicepollano.com/2010/04/25/HqlIntellisenseAWebBasedConsole.aspx</link>
      <pubDate>Sun, 25 Apr 2010 09:29:44 GMT</pubDate>
      <description>&lt;p&gt;
&lt;a href="http://bugsquash.blogspot.com/" target="_blank"&gt;Mauricio Scheffer&lt;/a&gt; has
just released a &lt;a href="http://bugsquash.blogspot.com/2010/04/nhwebconsole-01-released.html" target="_blank"&gt;web
based console for editing HQL&lt;/a&gt;. He based the intellisense on &lt;a href="http://sourceforge.net/projects/faticalabshqled/" target="_blank"&gt;my
project&lt;/a&gt;. I’m happy to see some of my effort reused somewhere! So thanks to Mauricio.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=60ee7985-45e2-4371-b632-7f12ecf1ed1e" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,60ee7985-45e2-4371-b632-7f12ecf1ed1e.aspx</comments>
      <category>HQL Intellisense</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=6ec28b7e-bf89-485d-ac78-e08bbe2f6185</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,6ec28b7e-bf89-485d-ac78-e08bbe2f6185.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,6ec28b7e-bf89-485d-ac78-e08bbe2f6185.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=6ec28b7e-bf89-485d-ac78-e08bbe2f6185</wfw:commentRss>
      <slash:comments>2</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
There is some interesting progress with my project <a href="http://sourceforge.net/projects/faticalabshqled/" target="_blank">Fatica.Labs.HqlEditor</a>.
I just want to share some screenshot:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/SomeProgresswithHqlIntellisense_10509/s5_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s5" border="0" alt="s5" src="http://www.felicepollano.com/public/WindowsLiveWriter/SomeProgresswithHqlIntellisense_10509/s5_thumb.png" width="490" height="356" />
          </a>
        </p>
        <p>
Well, it is growing to be a real tool, and in my idea would became a sort of test
bed in which the user can add or modify mapping, try the queries, change the config,
export a database script, reverse engineering and so on. Actually all the low level
tool to achieve that are available.
</p>
        <p>
Ok, let’s explain the layout:
</p>
        <ol>
          <li>
The document area, here we have mapping/config/hql <strong>all</strong> with <strong>intellisense</strong>.
In the screenshot the code completion for an Hql is shown. In future maybe I will
be able to insert a T4 editor for the hbm2net templates. 
</li>
          <li>
The project area: here we have a bounch of file that are representing our testing
project: mapping, configurations, assemblies and so on. I have use the MSbuild object
as a backend for the project, because in the near future I would like to use it to
really build some artifacts using <a href="http://nhforge.org/media/p/546.aspx" target="_blank">hbm2net</a> and <a href="http://nhforge.org/media/p/615.aspx" target="_blank">db2hbm</a>. 
</li>
          <li>
Here is the SQL preview of the query in editing. Now the view is showing an error
because the query is incomplete. 
</li>
          <li>
The funny log, a graphical appender for <a href="http://logging.apache.org/log4net/index.html" target="_blank">log4net</a> :-)</li>
        </ol>
        <p>
Some more words about the project itself: the testing environment is hosted in a separate
appdomain, this will allow us to:
</p>
        <ul>
          <li>
Modify the mapping runtime generating new version of the assembly 
</li>
          <li>
Testing production assemblies built with legacy nh versions ( well, not so legacy,
starting from 2.xxx )</li>
        </ul>
        <p>
Let’s have another screenshot, showing a real SQL preview:
</p>
        <p>
          <a href="http://www.felicepollano.com/public/WindowsLiveWriter/SomeProgresswithHqlIntellisense_10509/s7_2.png">
            <img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s7" border="0" alt="s7" src="http://www.felicepollano.com/public/WindowsLiveWriter/SomeProgresswithHqlIntellisense_10509/s7_thumb.png" width="509" height="322" />
          </a>
        </p>
        <p>
Next step is to produce the query results in some sort of usable representation (
I need to push the data across two app domain ) so I would probably use some JSON
serialization and then display the JSON raw data with some readable formatting.
</p>
        <p>
You can see a <a href="http://screencast.com/t/OGZkMmVlMjA" target="_blank">little
demo video here</a>.
</p>
        <p>
The project is not yet released, please treat it as a CTP ;) anyway, the svn repository
is here:
</p>
        <p>
          <code>
            <strong>https://faticalabshqled.svn.sourceforge.net/svnroot/faticalabshqled</strong>
          </code>
        </p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=6ec28b7e-bf89-485d-ac78-e08bbe2f6185" />
      </body>
      <title>Some Progress with HqlIntellisense…</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,6ec28b7e-bf89-485d-ac78-e08bbe2f6185.aspx</guid>
      <link>http://www.felicepollano.com/2010/04/22/SomeProgressWithHqlIntellisense.aspx</link>
      <pubDate>Thu, 22 Apr 2010 16:41:58 GMT</pubDate>
      <description>&lt;p&gt;
There is some interesting progress with my project &lt;a href="http://sourceforge.net/projects/faticalabshqled/" target="_blank"&gt;Fatica.Labs.HqlEditor&lt;/a&gt;.
I just want to share some screenshot:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/SomeProgresswithHqlIntellisense_10509/s5_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s5" border="0" alt="s5" src="http://www.felicepollano.com/public/WindowsLiveWriter/SomeProgresswithHqlIntellisense_10509/s5_thumb.png" width="490" height="356"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Well, it is growing to be a real tool, and in my idea would became a sort of test
bed in which the user can add or modify mapping, try the queries, change the config,
export a database script, reverse engineering and so on. Actually all the low level
tool to achieve that are available.
&lt;/p&gt;
&lt;p&gt;
Ok, let’s explain the layout:
&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
The document area, here we have mapping/config/hql &lt;strong&gt;all&lt;/strong&gt; with &lt;strong&gt;intellisense&lt;/strong&gt;.
In the screenshot the code completion for an Hql is shown. In future maybe I will
be able to insert a T4 editor for the hbm2net templates. 
&lt;li&gt;
The project area: here we have a bounch of file that are representing our testing
project: mapping, configurations, assemblies and so on. I have use the MSbuild object
as a backend for the project, because in the near future I would like to use it to
really build some artifacts using &lt;a href="http://nhforge.org/media/p/546.aspx" target="_blank"&gt;hbm2net&lt;/a&gt; and &lt;a href="http://nhforge.org/media/p/615.aspx" target="_blank"&gt;db2hbm&lt;/a&gt;. 
&lt;li&gt;
Here is the SQL preview of the query in editing. Now the view is showing an error
because the query is incomplete. 
&lt;li&gt;
The funny log, a graphical appender for &lt;a href="http://logging.apache.org/log4net/index.html" target="_blank"&gt;log4net&lt;/a&gt; :-)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;
Some more words about the project itself: the testing environment is hosted in a separate
appdomain, this will allow us to:
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Modify the mapping runtime generating new version of the assembly 
&lt;li&gt;
Testing production assemblies built with legacy nh versions ( well, not so legacy,
starting from 2.xxx )&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
Let’s have another screenshot, showing a real SQL preview:
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/WindowsLiveWriter/SomeProgresswithHqlIntellisense_10509/s7_2.png"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="s7" border="0" alt="s7" src="http://www.felicepollano.com/public/WindowsLiveWriter/SomeProgresswithHqlIntellisense_10509/s7_thumb.png" width="509" height="322"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
Next step is to produce the query results in some sort of usable representation (
I need to push the data across two app domain ) so I would probably use some JSON
serialization and then display the JSON raw data with some readable formatting.
&lt;/p&gt;
&lt;p&gt;
You can see a &lt;a href="http://screencast.com/t/OGZkMmVlMjA" target="_blank"&gt;little
demo video here&lt;/a&gt;.
&lt;/p&gt;
&lt;p&gt;
The project is not yet released, please treat it as a CTP ;) anyway, the svn repository
is here:
&lt;/p&gt;
&lt;p&gt;
&lt;code&gt;&lt;strong&gt;https://faticalabshqled.svn.sourceforge.net/svnroot/faticalabshqled&lt;/strong&gt;&lt;/code&gt;
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=6ec28b7e-bf89-485d-ac78-e08bbe2f6185" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,6ec28b7e-bf89-485d-ac78-e08bbe2f6185.aspx</comments>
      <category>Code GEneration</category>
      <category>HQL Intellisense</category>
      <category>NHibernate</category>
      <category>NHWorkBench</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=a079c621-5aa7-4a5a-84c0-7c6e03f31194</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,a079c621-5aa7-4a5a-84c0-7c6e03f31194.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,a079c621-5aa7-4a5a-84c0-7c6e03f31194.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=a079c621-5aa7-4a5a-84c0-7c6e03f31194</wfw:commentRss>
      <slash:comments>6</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p align="justify">
          <a href="http://fabiomaulo.blogspot.com/" target="_blank">Fabio Maulo</a> sta proponendo
una nuova astrategia di mapping per NHibernate: <a href="http://code.google.com/p/codeconform/" target="_blank">ConfORM</a>.
In pratica si tratta di una strategia code only, quindi nessun file di XML, ma tutto
via codice <strike>con l’approccio fluent interface</strike>. Stranamente la community
si è un po’ stupita di vedere un ennesima strategia, e tutti stanno lì a chiedersi
il perchè. Bene, il perchè è che è una <strong>nuova possibilità di scelta</strong>,
ed avere molte scelte è un plus degli ambienti open source. In un <a href="http://fabiomaulo.blogspot.com/2010/03/nhibernate-mappings-path.html" target="_blank">suo
post</a> Fabio disegna uno scenario completo della ricca rosa di partecipanti al problema
mapping. Difatto <a href="http://code.google.com/p/codeconform/" target="_blank">ConfORM</a> è
l’unica API che sfonda completamente lo strato hbm, e va direttamente alla radice.
Tutto questo si traduce immediatamente in un incremento di performance, ed in una
migliore linearità progettuale: meno strati è meglio, anzi, meno strati inutili è
meglio. Francamente, dopo una piccola esperienza acquisita nel problema mapping con
la scrittura del tool NHModeller, ho deciso di tornare ed imparare la strategia HBM.
Dopo un po’ non è così male, ma la prossima volta che faccio un progetto mio provo
ad usarlo ( in azienda non se ne parla nemmeno: già il mapping XML è visto come una
stregoneria, e c’è chi legifera che mappare le foreign Key come long sia una buona
idea anzichè un antipattern ;-) ).
</p>
        <p align="justify">
In conclusione: chissenefrega se un nuovo sistema sembra essere il duplicato di un
altro:Vincerà il migliore, ed in ogni caso il migliore secondo gli utilizzatori :-)
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=a079c621-5aa7-4a5a-84c0-7c6e03f31194" />
      </body>
      <title>NHibernate: mapping con ConfORM</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,a079c621-5aa7-4a5a-84c0-7c6e03f31194.aspx</guid>
      <link>http://www.felicepollano.com/2010/04/20/NHibernateMappingConConfORM.aspx</link>
      <pubDate>Tue, 20 Apr 2010 18:22:46 GMT</pubDate>
      <description>&lt;p align="justify"&gt;
&lt;a href="http://fabiomaulo.blogspot.com/" target="_blank"&gt;Fabio Maulo&lt;/a&gt; sta proponendo
una nuova astrategia di mapping per NHibernate: &lt;a href="http://code.google.com/p/codeconform/" target="_blank"&gt;ConfORM&lt;/a&gt;.
In pratica si tratta di una strategia code only, quindi nessun file di XML, ma tutto
via codice &lt;strike&gt;con l’approccio fluent interface&lt;/strike&gt;. Stranamente la community
si è un po’ stupita di vedere un ennesima strategia, e tutti stanno lì a chiedersi
il perchè. Bene, il perchè è che è una &lt;strong&gt;nuova possibilità di scelta&lt;/strong&gt;,
ed avere molte scelte è un plus degli ambienti open source. In un &lt;a href="http://fabiomaulo.blogspot.com/2010/03/nhibernate-mappings-path.html" target="_blank"&gt;suo
post&lt;/a&gt; Fabio disegna uno scenario completo della ricca rosa di partecipanti al problema
mapping. Difatto &lt;a href="http://code.google.com/p/codeconform/" target="_blank"&gt;ConfORM&lt;/a&gt; è
l’unica API che sfonda completamente lo strato hbm, e va direttamente alla radice.
Tutto questo si traduce immediatamente in un incremento di performance, ed in una
migliore linearità progettuale: meno strati è meglio, anzi, meno strati inutili è
meglio. Francamente, dopo una piccola esperienza acquisita nel problema mapping con
la scrittura del tool NHModeller, ho deciso di tornare ed imparare la strategia HBM.
Dopo un po’ non è così male, ma la prossima volta che faccio un progetto mio provo
ad usarlo ( in azienda non se ne parla nemmeno: già il mapping XML è visto come una
stregoneria, e c’è chi legifera che mappare le foreign Key come long sia una buona
idea anzichè un antipattern ;-) ).
&lt;/p&gt;
&lt;p align="justify"&gt;
In conclusione: chissenefrega se un nuovo sistema sembra essere il duplicato di un
altro:Vincerà il migliore, ed in ogni caso il migliore secondo gli utilizzatori :-)
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=a079c621-5aa7-4a5a-84c0-7c6e03f31194" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,a079c621-5aa7-4a5a-84c0-7c6e03f31194.aspx</comments>
      <category>ConfORM</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=c4316512-b6fe-48ff-8573-2dd2f063a0bb</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,c4316512-b6fe-48ff-8573-2dd2f063a0bb.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,c4316512-b6fe-48ff-8573-2dd2f063a0bb.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=c4316512-b6fe-48ff-8573-2dd2f063a0bb</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
If anybody still uses HQL with NHibernate, it would probably find useful some editing
with intellisense.
</p>
        <p>
Using the <a href="http://www.sharpdevelop.net/OpenSource/SD/" target="_blank">SharpDevelop</a> Text
Editor, the ANTLR grammar from the NHibernate sources, and some hacking in the java
Eclipse Plugin code, the results is this:
</p>
        <p>
 
</p>
        <h3>Ctrl+Space completion 1: entity alias
</h3>
        <p>
          <a href="http://www.felicepollano.com/public/98e07bda-9ed1-4ae7-aaa7-f56a1f2b7113.png">
            <img style="border-width: 0px; display: inline;" title="s1" alt="s1" src="http://www.felicepollano.com/public/0a1e7eac-72ac-458c-b5e0-a7b5656b48b1.png" border="0" height="284" width="477" />
          </a>
        </p>
        <h3>Ctrl+Space completion 2: Entity names
</h3>
        <p>
          <a href="http://www.felicepollano.com/public/7c721939-64ac-467f-a2c7-c00f2d6ddec4.png">
            <img style="border-width: 0px; display: inline;" title="s2" alt="s2" src="http://www.felicepollano.com/public/21b1b3b2-9b8e-4352-b242-3cffc909f3d5.png" border="0" height="161" width="477" />
          </a>
        </p>
        <h3>Dot completion: property completion
</h3>
        <p>
 
</p>
        <p>
          <a href="http://www.felicepollano.com/public/3d87e925-c91b-430e-a7ca-d72d289e1f86.png">
            <img style="border-width: 0px; display: inline;" title="s3" alt="s3" src="http://www.felicepollano.com/public/1c302ee9-dcae-4e66-99f3-cc93afe25bb9.png" border="0" height="161" width="477" />
          </a>
        </p>
        <p>
 
</p>
        <h3>Ctrl+Space completion: all keywords and functions
</h3>
        <p>
 
</p>
        <p>
        </p>
        <p>
          <a href="http://www.felicepollano.com/public/543ecee9-b73a-4784-b6b0-cd7932f51929.png">
            <img style="border-width: 0px; display: inline;" title="s4" alt="s4" src="http://www.felicepollano.com/public/fdc7204e-e241-4cd8-9e31-f194c0c21d5a.png" border="0" height="230" width="576" />
          </a>
        </p>
        <p>
          <a href="http://sourceforge.net/projects/faticalabshqled/">Here you can find</a> the
related sourceforge project.
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=c4316512-b6fe-48ff-8573-2dd2f063a0bb" />
      </body>
      <title>HQL editor with intellisense</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,c4316512-b6fe-48ff-8573-2dd2f063a0bb.aspx</guid>
      <link>http://www.felicepollano.com/2010/03/30/HQLEditorWithIntellisense.aspx</link>
      <pubDate>Tue, 30 Mar 2010 15:44:42 GMT</pubDate>
      <description>&lt;p&gt;
If anybody still uses HQL with NHibernate, it would probably find useful some editing
with intellisense.
&lt;/p&gt;
&lt;p&gt;
Using the &lt;a href="http://www.sharpdevelop.net/OpenSource/SD/" target="_blank"&gt;SharpDevelop&lt;/a&gt; Text
Editor, the ANTLR grammar from the NHibernate sources, and some hacking in the java
Eclipse Plugin code, the results is this:
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;h3&gt;Ctrl+Space completion 1: entity alias
&lt;/h3&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/98e07bda-9ed1-4ae7-aaa7-f56a1f2b7113.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="s1" alt="s1" src="http://www.felicepollano.com/public/0a1e7eac-72ac-458c-b5e0-a7b5656b48b1.png" border="0" height="284" width="477"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;h3&gt;Ctrl+Space completion 2: Entity names
&lt;/h3&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/7c721939-64ac-467f-a2c7-c00f2d6ddec4.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="s2" alt="s2" src="http://www.felicepollano.com/public/21b1b3b2-9b8e-4352-b242-3cffc909f3d5.png" border="0" height="161" width="477"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;h3&gt;Dot completion: property completion
&lt;/h3&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/3d87e925-c91b-430e-a7ca-d72d289e1f86.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="s3" alt="s3" src="http://www.felicepollano.com/public/1c302ee9-dcae-4e66-99f3-cc93afe25bb9.png" border="0" height="161" width="477"&gt;&lt;/a&gt; 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;h3&gt;Ctrl+Space completion: all keywords and functions
&lt;/h3&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://www.felicepollano.com/public/543ecee9-b73a-4784-b6b0-cd7932f51929.png"&gt;&lt;img style="border-width: 0px; display: inline;" title="s4" alt="s4" src="http://www.felicepollano.com/public/fdc7204e-e241-4cd8-9e31-f194c0c21d5a.png" border="0" height="230" width="576"&gt;&lt;/a&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://sourceforge.net/projects/faticalabshqled/"&gt;Here you can find&lt;/a&gt; the
related sourceforge project.
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=c4316512-b6fe-48ff-8573-2dd2f063a0bb" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,c4316512-b6fe-48ff-8573-2dd2f063a0bb.aspx</comments>
      <category>HQL Intellisense</category>
      <category>NHibernate</category>
    </item>
    <item>
      <trackback:ping>http://www.felicepollano.com/Trackback.aspx?guid=0aca7518-698a-45bf-a10d-abb81314cd6d</trackback:ping>
      <pingback:server>http://www.felicepollano.com/pingback.aspx</pingback:server>
      <pingback:target>http://www.felicepollano.com/PermaLink,guid,0aca7518-698a-45bf-a10d-abb81314cd6d.aspx</pingback:target>
      <dc:creator>Felice Pollano</dc:creator>
      <wfw:comment>http://www.felicepollano.com/CommentView,guid,0aca7518-698a-45bf-a10d-abb81314cd6d.aspx</wfw:comment>
      <wfw:commentRss>http://www.felicepollano.com/SyndicationService.asmx/GetEntryCommentsRss?guid=0aca7518-698a-45bf-a10d-abb81314cd6d</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Esiste, o meglio esisteva un tool di code generation, per creare automaticamente le
classi partendo dai file di mapping di NHibernate. Questo tool (hbm2net, presente
in NHContrib ) è stato un po' dimenticato, per cui ho deciso di provare a riesumarlo,
e di ammodernarlo un po' dandogli la possibilità di utilizzare il <a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx" target="_blank">Text
Template Transformation Toolkit (T4)</a>. Ho previsto un template interno per la semplice
generazione delle classi di mapping, ma potenzialmente è possibile generare con facilità <strong>qualsiasi
altro codice</strong> provvedendo un template esterno, ad esempio mascherine di UI,
layer WCF etc etc. 
</p>
        <p>
La versione attuale è una pre-alfa, serve solo a dare un'idea, e a vedere se ci sono
delle dipendenze in deploy di difficile gestione, non è ben chiaro a me se T4 sia
presente  in tutte le installazioni di Visual Studio. 
</p>
        <p>
          <strike>Se volete provare il tool  <a href="http://cid-b8821720666a55e7.skydrive.live.com/self.aspx/.Public/hbm2net.zip">potete
scaricarlo da qui</a>. Per utilizzare il templating T4 dovete utilizzare la seguente
linea di comand: </strike>
        </p>
        <p>
          <strike>
            <strong>hbm2net --config=t4config.xml *.hbm.xml</strong>
          </strike>
        </p>
        <p>
          <strike> è importante utilizzare il config indicato, altrimenti hbm2net defaulta sul
render di NVelocity.  Verra creata una cartella generated con i file sorgenti
corrisondenti agli hbm. 
<br /></strike>
        </p>
        <p>
          <a href="http://nhforge.org/media/p/546.aspx">Potete scaricare hbm2net da qui</a>.<br /></p>
        <p>
Per provare al volo è incluso nello zip anche un file di mapping simple1.hbm.xml. 
</p>
        <p>
Fatemi avere dei feedback! 
</p>
        <p>
  
</p>
        <img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=0aca7518-698a-45bf-a10d-abb81314cd6d" />
      </body>
      <title>hbm2net: tentativo di resurrezione</title>
      <guid isPermaLink="false">http://www.felicepollano.com/PermaLink,guid,0aca7518-698a-45bf-a10d-abb81314cd6d.aspx</guid>
      <link>http://www.felicepollano.com/2009/10/17/hbm2netTentativoDiResurrezione.aspx</link>
      <pubDate>Sat, 17 Oct 2009 14:50:00 GMT</pubDate>
      <description>&lt;p&gt;
Esiste, o meglio esisteva un tool di code generation, per creare automaticamente le
classi partendo dai file di mapping di NHibernate. Questo tool (hbm2net, presente
in NHContrib ) è stato un po' dimenticato, per cui ho deciso di provare a riesumarlo,
e di ammodernarlo un po' dandogli la possibilità di utilizzare il &lt;a href="http://msdn.microsoft.com/en-us/library/bb126445.aspx" target="_blank"&gt;Text
Template Transformation Toolkit (T4)&lt;/a&gt;. Ho previsto un template interno per la semplice
generazione delle classi di mapping, ma potenzialmente è possibile generare con facilità &lt;strong&gt;qualsiasi
altro codice&lt;/strong&gt; provvedendo un template esterno, ad esempio mascherine di UI,
layer WCF etc etc. 
&lt;/p&gt;
&lt;p&gt;
La versione attuale è una pre-alfa, serve solo a dare un'idea, e a vedere se ci sono
delle dipendenze in deploy di difficile gestione, non è ben chiaro a me se T4 sia
presente&amp;nbsp; in tutte le installazioni di Visual Studio. 
&lt;/p&gt;
&lt;p&gt;
&lt;strike&gt;Se volete provare il tool&amp;nbsp; &lt;a href="http://cid-b8821720666a55e7.skydrive.live.com/self.aspx/.Public/hbm2net.zip"&gt;potete
scaricarlo da qui&lt;/a&gt;. Per utilizzare il templating T4 dovete utilizzare la seguente
linea di comand: &lt;/strike&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;strike&gt;&lt;strong&gt;hbm2net --config=t4config.xml *.hbm.xml&lt;/strong&gt;&lt;/strike&gt; 
&lt;/p&gt;
&lt;p&gt;
&lt;strike&gt; è importante utilizzare il config indicato, altrimenti hbm2net defaulta sul
render di NVelocity.&amp;nbsp; Verra creata una cartella generated con i file sorgenti
corrisondenti agli hbm. 
&lt;br&gt;
&lt;/strike&gt;
&lt;/p&gt;
&lt;p&gt;
&lt;a href="http://nhforge.org/media/p/546.aspx"&gt;Potete scaricare hbm2net da qui&lt;/a&gt;.&lt;br&gt;
&lt;/p&gt;
&lt;p&gt;
Per provare al volo è incluso nello zip anche un file di mapping simple1.hbm.xml. 
&lt;/p&gt;
&lt;p&gt;
Fatemi avere dei feedback! 
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp; 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.felicepollano.com/aggbug.ashx?id=0aca7518-698a-45bf-a10d-abb81314cd6d" /&gt;</description>
      <comments>http://www.felicepollano.com/CommentView,guid,0aca7518-698a-45bf-a10d-abb81314cd6d.aspx</comments>
      <category>NHibernate</category>
    </item>
  </channel>
</rss>