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

<channel>
	<title>Dario Quintana &#187; NHibernate</title>
	<atom:link href="http://darioquintana.com.ar/blogging/category/nhibernate/feed/" rel="self" type="application/rss+xml" />
	<link>http://darioquintana.com.ar/blogging</link>
	<description>at blogging</description>
	<lastBuildDate>Mon, 26 Oct 2009 16:24:08 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>NHibernate Validator 1.2 Beta3 released</title>
		<link>http://darioquintana.com.ar/blogging/2009/10/26/nhibernate-validator-1-2-beta3-released/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/10/26/nhibernate-validator-1-2-beta3-released/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 16:24:08 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[NHibernate.Contrib]]></category>
		<category><![CDATA[NHibernate.Validator]]></category>
		<category><![CDATA[NHibernate Validator]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=88</guid>
		<description><![CDATA[
Download NHibernate Validator 1.2 beta3 with sources, binaries and example here here
For use it with NHibernate 2.1 GA.
For examples and documentation see the serie of blog posts of Fabio Maulo about NHibernate Validator here
]]></description>
			<content:encoded><![CDATA[<p><img src="http://darioquintana.com.ar/files/NHV-logo-white-background.png" alt="" /></p>
<p>Download NHibernate Validator 1.2 beta3 with sources, binaries and example here <a href="https://sourceforge.net/projects/nhcontrib/files">here</a></p>
<p>For use it with NHibernate 2.1 GA.</p>
<p>For examples and documentation see the serie of blog posts of Fabio Maulo about NHibernate Validator <a href="http://fabiomaulo.blogspot.com/search/label/Validator">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/10/26/nhibernate-validator-1-2-beta3-released/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>NHibernate Validator 1.2 Beta2 released</title>
		<link>http://darioquintana.com.ar/blogging/2009/10/10/nhibernate-validator-1-2-beta2-released/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/10/10/nhibernate-validator-1-2-beta2-released/#comments</comments>
		<pubDate>Sat, 10 Oct 2009 18:13:05 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[NHibernate.Validator]]></category>
		<category><![CDATA[NHibernate Validator]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=85</guid>
		<description><![CDATA[
Download NHibernate Validator 1.2 beta2 with sources, binaries and example here here
For use it with NHibernate 2.1 GA.
Enjoy it !
]]></description>
			<content:encoded><![CDATA[<p><img src="http://darioquintana.com.ar/files/NHV-logo-white-background.png" alt="" /></p>
<p>Download NHibernate Validator 1.2 beta2 with sources, binaries and example here <a href="https://sourceforge.net/projects/nhcontrib/files">here</a></p>
<p>For use it with NHibernate 2.1 GA.</p>
<p>Enjoy it !</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/10/10/nhibernate-validator-1-2-beta2-released/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>NHibernate Validator Quickstart</title>
		<link>http://darioquintana.com.ar/blogging/2009/05/18/nhibernate-validator-quickstart/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/05/18/nhibernate-validator-quickstart/#comments</comments>
		<pubDate>Mon, 18 May 2009 04:51:28 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[NHibernate.Validator]]></category>
		<category><![CDATA[Quickstart]]></category>
		<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=68</guid>
		<description><![CDATA[
The NHibernate Validator Team had prepared examples to you be able to use this validation framework in a easy way. With four examples we are covering the following topics:
1) Winforms
In this example you will how you can easily integrate NHibernate Validator and some helper clases with System.Windows.Forms.
2) NHibernate Integration
Trying to integrate NHibernate Validator with NHibernate? [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://darioquintana.com.ar/files/NHV-logo-white-background.png" alt="" /></p>
<p>The NHibernate Validator Team had prepared examples to you be able to use this validation framework in a easy way. With four examples we are covering the following topics:</p>
<h3>1) Winforms</h3>
<p>In this example you will how you can easily integrate NHibernate Validator and some helper clases with System.Windows.Forms.</p>
<h3>2) NHibernate Integration</h3>
<p>Trying to integrate NHibernate Validator with NHibernate? Not a problem. In this example you will how really get these 2 great frameworks working together. NHibernate Validator let you intercept Saves and Updates from NHibernate validating your entities before these changes take place. Note you have to create a database based on the configured connection string.</p>
<h3>3) Asp.Net MVC</h3>
<p>Asp.Net MVC has a cool way to add validation errors from model and display them all into the View. This example cover the easy integration between these frameworks. Note, you need Asp.Net MVC installed into your machine.<a title="Download Asp.net MVC" href="http://www.asp.net/mvc/">Download Asp.net MVC</a></p>
<h3>4) Entity Validator</h3>
<p>Sometimes you need to validate a property which depends of another(s) property(ies). The most common example is when you have to validate a range of dates. This example cover this funcionality and show to us how to configurate it using attributes, xml and fluent.</p>
<h2><a href="https://sourceforge.net/project/showfiles.php?group_id=216446&amp;package_id=275108">Download it here</a></h2>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/05/18/nhibernate-validator-quickstart/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NHibernate Validator and Asp.Net MVC</title>
		<link>http://darioquintana.com.ar/blogging/2009/04/02/nhibernate-validator-and-aspnet-mvc/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/04/02/nhibernate-validator-and-aspnet-mvc/#comments</comments>
		<pubDate>Fri, 03 Apr 2009 00:06:55 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[Asp.Net MVC]]></category>
		<category><![CDATA[NHibernate.Validator]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=65</guid>
		<description><![CDATA[ Download the example here.
Asp.Net MVC has a cool way to add validation errors from the model and display them all into the View. It?s actually using the ModelState. As you may know NHibernate Validator (NHV) is a framework to validate entities, so what about if we let the validation to the framework that can manage [...]]]></description>
			<content:encoded><![CDATA[<h4> <a href="http://darioquintana.googlecode.com/files/MvcNhvExample.zip">Download the example here.</a></h4>
<p>Asp.Net MVC has a cool way to add validation errors from the model and display them all into the View. It?s actually using the ModelState. As you may know NHibernate Validator (NHV) is a framework to validate entities, so what about if we let the validation to the framework that can manage it? So the integration of NHV to Asp.Net MVC is easy. I created a new Asp.Net MVC project and added some files to my solution to make they look like this: <img style="display: block; float: none; margin-left: auto; margin-right: auto" src="http://darioquintana.com.ar/files/MvcNhv00.png" alt="" /></p>
<p>First I added the libraries needed to NHV (this libraries we need in case to use NHibernate too, otherwise you don?t need Linfu stuff to get proxies working). The libraries are:</p>
<p><img src="http://darioquintana.com.ar/files/MvcNhv05.png" alt="" /></p>
<p>Once the libraries are referenced, NHV need to be initialized, actually in this example that initialization will consist in a Validator Engine provider, capable to be accessed from everywhere into our web-application. A good point do this, is in the Global.asax. The next method <em>InitializeValidator</em> it?s called from the <em>Application_Start</em>.</p>
<p><img src="http://darioquintana.com.ar/files/MvcNhv03.jpg" alt="" /></p>
<p>Then I created a new View Manage.aspx, actually the view is a copy, with modifications, of Register.aspx View. Such View should looks like this one. As you may see, seems like there are some messages of validation, means, a validation that didn?t pass.  Now let?s see the code to explore the minimal code to introduce NHibernate Validator as a Framework to Validate our MVC application.<img src="http://darioquintana.com.ar/files/MvcNhv01.jpg" alt="" /></p>
<p>First of all, our entity Customer, which reflex the view with a Name and a Email properties, should looks like this with the NHV attributes. Remember that NHV can be configured using Attributes (default), Xml or Fluent-Interfaces, and accept mix of configurations too.</p>
<p><img src="http://darioquintana.com.ar/files/MvcNhv04.png" alt="" /></p>
<p>Second, we need the integration point between NHibernate Validator and Asp.Net MVC, and that point consist just in a little piece of code that make the validation and modifies the current state of the model. We need just a few lines:</p>
<p><img src="http://darioquintana.com.ar/files/MvcNhv01.png" alt="" /></p>
<p>The picture shows an extension method which first of all, get a new ValidatorEngine instance, which is a singleton in whole web application. Actually, to use a ValidatorEngine we need just one instance, because NHV make a lot of useful caching and it configure itself in the way we are using it. Then we validate the entity and get all the InvalidValues of the object. If the entity is in invalid state (break one rule defined), NHV we well generate a InvalidValue array with all errors we should show to the user. Iterate through all the items and we add them all to the ModelState. Once we add one model error, the model is no longer valid.</p>
<p>Once we have our extension, let?s use it.</p>
<p><img src="http://darioquintana.com.ar/files/MvcNhv02.png" alt="" /></p>
<p>Validate Method is the extension we made before, and that method is going to modify the ModelState if it?s needed.</p>
<p>And that?s all folks, hope this helps.</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/04/02/nhibernate-validator-and-aspnet-mvc/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>NHibernate Validator 1.2 alpha3</title>
		<link>http://darioquintana.com.ar/blogging/2009/03/30/nhibernate-validator-12-alpha3/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/03/30/nhibernate-validator-12-alpha3/#comments</comments>
		<pubDate>Mon, 30 Mar 2009 12:54:41 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[NHibernate.Validator]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=64</guid>
		<description><![CDATA[
Download NHibernate Validator 1.2 alpha3 with sources and binaries here
This release demostrate to be very stable and is an update to use it with NHibernate 2.1alpha2. For those who have NH.Validator 1.2alpha1 this is a mandatory update.
Enjoy it !
]]></description>
			<content:encoded><![CDATA[<p><img src="http://darioquintana.com.ar/files/NHV-logo-white-background.png" /></p>
<p>Download NHibernate Validator 1.2 alpha3 with sources and binaries <a href="http://is.gd/pxyc">here</a></p>
<p>This release demostrate to be very stable and is an update to use it with NHibernate 2.1alpha2. For those who have NH.Validator 1.2alpha1 this is a mandatory update.</p>
<p>Enjoy it !</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/03/30/nhibernate-validator-12-alpha3/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>New NHibernate and NHibernate Validator releases</title>
		<link>http://darioquintana.com.ar/blogging/2009/03/16/new-nhibernate-and-nhibernate-validator-releases/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/03/16/new-nhibernate-and-nhibernate-validator-releases/#comments</comments>
		<pubDate>Mon, 16 Mar 2009 14:51:13 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[NHibernate.Contrib]]></category>
		<category><![CDATA[NHibernate.Validator]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=61</guid>
		<description><![CDATA[
NHibernate 2.1 alpha1. See official release. Download. 
NHibernate.Validator 1.2 alpha1. See official release. Download.

]]></description>
			<content:encoded><![CDATA[<ul>
<li>NHibernate 2.1 alpha1. <a href="http://nhforge.org/blogs/nhibernate/archive/2009/03/15/nhibernate-2-1-0-on-the-road.aspx">See official release</a>. <a href="https://sourceforge.net/project/platformdownload.php?group_id=73818">Download</a>. </li>
<li>NHibernate.Validator 1.2 alpha1. <a href="http://nhforge.org/blogs/nhibernate/archive/2009/03/16/nhibernate-validator-1-2-alpha1-released.aspx">See official release</a>. <a href="https://sourceforge.net/project/showfiles.php?group_id=216446&amp;package_id=275108">Download</a>.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/03/16/new-nhibernate-and-nhibernate-validator-releases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Registering FREETEXT or CONTAINS functions into a NHibernate dialect</title>
		<link>http://darioquintana.com.ar/blogging/2009/03/13/registering-freetext-or-contains-functions-into-a-nhibernate-dialect/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/03/13/registering-freetext-or-contains-functions-into-a-nhibernate-dialect/#comments</comments>
		<pubDate>Fri, 13 Mar 2009 15:19:38 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=59</guid>
		<description><![CDATA[Ms Sql Server FREETEXT and CONTAINS functions are used into FullText search capabilities to querying. These functions are of course natives to this particular RDBMS and even comes a with particular structure: they don?t return a value. So far, till NH 2.0, you couldn?t do it because a little parser issue, but from NHibernate 2.1 [...]]]></description>
			<content:encoded><![CDATA[<p>Ms Sql Server FREETEXT and CONTAINS functions are used into FullText search capabilities to querying. These functions are of course natives to this particular RDBMS and even comes a with particular structure: they don?t return a value. So far, till NH 2.0, you couldn?t do it because a little parser issue, but from <b>NHibernate 2.1</b> in forward you?re enable register them.</p>
<p>First of all, we define the new dialect with the new functions in order that when we run a query, NHibernate can recognize those functions and can transform to native-sql, in this case, Transact-SQL.</p>
<pre class="csharpcode">
<span class="kwrd">using</span> NHibernate.Dialect;
<span class="kwrd">using</span> NHibernate.Dialect.Function;

<span class="kwrd">namespace</span> MyCompany.Data
{
    <span class="kwrd">public</span> <span class="kwrd">class</span> MyDialect : MsSql2008Dialect
    {
        <span class="kwrd">public</span> MyDialect()
        {
            RegisterFunction(<span class="str">"freetext"</span>, <span class="kwrd">new</span> StandardSQLFunction(<span class="str">"freetext"</span>, <span class="kwrd">null</span>));
            RegisterFunction(<span class="str">"contains"</span>, <span class="kwrd">new</span> StandardSQLFunction(<span class="str">"contains"</span>, <span class="kwrd">null</span>));
        }
    }
}</pre>
<p>Note that we are using <b>StandardSQLFunction</b>, we can also use <b>SQLFunctionTemplate</b> or implement our <b>ISQLFunction</b> class with all the constraints (ie: parameter number accepted) we need.</p>
<p>Once our new dialect is ready let?s call it from our <i>hibernate.cfg.xml</i> file, then NHibernate can know that this dialect will be inject. Suppose <b>MyDialect</b> is placed into the assembly <b>MyCompany.Data</b>, so the configuration file should look like this:</p>
<p><!-- code formatted by http://manoli.net/csharpformat/ --></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="attr">encoding</span><span class="kwrd">="utf-8"</span> ?<span class="kwrd">&gt;</span>
<span class="kwrd">&lt;</span><span class="html">hibernate-configuration</span>  <span class="attr">xmlns</span><span class="kwrd">="urn:nhibernate-configuration-2.2"</span> <span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;</span><span class="html">session-factory</span> <span class="attr">name</span><span class="kwrd">="NH"</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">property</span> <span class="attr">name</span><span class="kwrd">="dialect"</span><span class="kwrd">&gt;</span>MyCompany.Data.MyDialect, MyCompany.Data<span class="kwrd">&lt;/</span><span class="html">property</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">property</span> <span class="attr">name</span><span class="kwrd">="connection.connection_string"</span><span class="kwrd">&gt;</span>
            Data Source=(local)\sqlexpress;Initial Catalog=test;Integrated Security = true
        <span class="kwrd">&lt;/</span><span class="html">property</span><span class="kwrd">&gt;</span>
        <span class="kwrd">&lt;</span><span class="html">property</span> <span class="attr">name</span><span class="kwrd">="proxyfactory.factory_class"</span><span class="kwrd">&gt;</span>NHibernate.ByteCode.LinFu.ProxyFactoryFactory, NHibernate.ByteCode.LinFu<span class="kwrd">&lt;/</span><span class="html">property</span><span class="kwrd">&gt;</span>
    <span class="kwrd">&lt;/</span><span class="html">session-factory</span><span class="kwrd">&gt;</span>
<span class="kwrd">&lt;/</span><span class="html">hibernate-configuration</span><span class="kwrd">&gt;</span></pre>
<p>Everything is ready, you just have to do this 2 steps and the functions are ready to use it, then we can query using them.</p>
<pre class="csharpcode">
session.CreateQuery(<span class="str">"from Documento where freetext(Texto,:keywords)"</span>)
    .SetString(<span class="str">"keywords"</span>,<span class="str">"hey apple car"</span>)
    .List();</pre>
<p>Note the above query is HQL, so NHibernate knows about <b>freetext</b> and can operate with it.</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/03/13/registering-freetext-or-contains-functions-into-a-nhibernate-dialect/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NHibernate and Ms Sql Server 2008: Date, Time, DateTime2 and DateTimeOffset</title>
		<link>http://darioquintana.com.ar/blogging/2009/03/12/nhibernate-and-ms-sql-server-2008-date-time-datetime2-and-datetimeoffset/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/03/12/nhibernate-and-ms-sql-server-2008-date-time-datetime2-and-datetimeoffset/#comments</comments>
		<pubDate>Thu, 12 Mar 2009 11:01:59 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate]]></category>
		<category><![CDATA[Sql Server 2008]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=57</guid>
		<description><![CDATA[Ms Sql Server 2008 come with a lot of features talking about Date/Time. Besides the already known DbType.DateTime, now we have new types:

Date 
Time 
DateTime2 
DateTimeOffset

NHibernate 2.1 introduce changes to support this types out-of-the-box. This table show all the details about how to configurate your system: classes, mappings:




CLR Type 


DbType 


Sql Server Type


NHibernate type




System.DateTime


DateTime


datetime


datetime




System.DateTime


DateTime2


datetime2


datetime2




System.DateTime


Date


date


date




System.TimeSpan


Time


time


TimeAsTimeSpan




System.DateTime


Time


time


time




System.DateTimeOffset


DateTimeOffset


datetimeoffset


datetimeoffset




A breaking [...]]]></description>
			<content:encoded><![CDATA[<p>Ms Sql Server 2008 come with a lot of features talking about Date/Time. Besides the already known DbType.DateTime, now we have new types:</p>
<ul>
<li><em><strong>Date </strong></em></li>
<li><em><strong>Time </strong></em></li>
<li><em><strong>DateTime2 </strong></em></li>
<li><em><strong>DateTimeOffset</strong></em></li>
</ul>
<p>NHibernate 2.1 introduce changes to support this types out-of-the-box. This table show all the details about how to configurate your system: classes, mappings:</p>
<table border="1" cellspacing="0" cellpadding="2" width="614">
<tbody>
<tr>
<td width="155" valign="top">
<p align="center"><strong>CLR Type </strong></p>
</td>
<td width="111" valign="top">
<p align="center"><strong>DbType </strong></p>
</td>
<td width="152" valign="top">
<p align="center"><strong>Sql Server Type</strong></p>
</td>
<td width="194" valign="top">
<p align="center"><strong>NHibernate type</strong></p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTime</p>
</td>
<td width="111" valign="top">
<p align="center">DateTime</p>
</td>
<td width="152" valign="top">
<p align="center">datetime</p>
</td>
<td width="194" valign="top">
<p align="center">datetime</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTime</p>
</td>
<td width="111" valign="top">
<p align="center">DateTime2</p>
</td>
<td width="152" valign="top">
<p align="center">datetime2</p>
</td>
<td width="194" valign="top">
<p align="center">datetime2</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTime</p>
</td>
<td width="111" valign="top">
<p align="center">Date</p>
</td>
<td width="152" valign="top">
<p align="center">date</p>
</td>
<td width="194" valign="top">
<p align="center">date</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.TimeSpan</p>
</td>
<td width="111" valign="top">
<p align="center">Time</p>
</td>
<td width="152" valign="top">
<p align="center">time</p>
</td>
<td width="194" valign="top">
<p align="center">TimeAsTimeSpan</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTime</p>
</td>
<td width="111" valign="top">
<p align="center">Time</p>
</td>
<td width="152" valign="top">
<p align="center">time</p>
</td>
<td width="194" valign="top">
<p align="center">time</p>
</td>
</tr>
<tr>
<td width="155" valign="top">
<p align="center">System.DateTimeOffset</p>
</td>
<td width="111" valign="top">
<p align="center">DateTimeOffset</p>
</td>
<td width="152" valign="top">
<p align="center">datetimeoffset</p>
</td>
<td width="194" valign="top">
<p align="center">datetimeoffset</p>
</td>
</tr>
</tbody>
</table>
<p>A breaking change was introduced: the old <em>TimeSpan</em> NHibernate type was moved to <em>TimeSpanInt64</em> (it uses a System.Int64).</p>
<p>When we talk about ?NHibernate type?, we are refering to what you?ve to put into your mappings, i.e: <em><strong>&lt;property name=?OnlineMeeting? type=?datetimeoffset?/&gt;</strong> </em>.</p>
<p>To use this features and more you?ve to use the dialect <strong><em>NHibernate.Dialect.MsSql2008Dialect</em></strong>.</p>
<p>The dialect changes include these types and changes to <strong>Hql functions</strong> that return the current system timestamp.</p>
<ul>
<li><strong>current_timestamp</strong>: Now returns the current system timestamp as a DateTime2 value. It uses <em>sysdatetime</em> Sql Server function at background.</li>
<li><strong>current_timestamp_offset</strong>: New function!. Returns the current system timestamp with the offset as a DateTimeOffset value. It uses <em>sysdatetimeoffset</em> Sql Server function at background.</li>
</ul>
<p>The idea of this post isn?t to explain every new type and what it can do, otherwise is to show you what have to do in your classes, queries or mappings to configure your date/time types with NHibernate. Besides, to know every detail of these types you can visit this useful <a href="http://msdn.microsoft.com/en-us/library/bb675168.aspx">.NET Framework Developer&#8217;s Guide</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/03/12/nhibernate-and-ms-sql-server-2008-date-time-datetime2-and-datetimeoffset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Future&lt;T&gt; Queries with HQL and Criteria</title>
		<link>http://darioquintana.com.ar/blogging/2009/01/29/futuret-queries-with-hql-and-criteria/</link>
		<comments>http://darioquintana.com.ar/blogging/2009/01/29/futuret-queries-with-hql-and-criteria/#comments</comments>
		<pubDate>Thu, 29 Jan 2009 19:31:09 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=54</guid>
		<description><![CDATA[A few days ago Oren Eini and Davy Brion were working in a new feature for NH 2.1 (no a release yet) called Future, in the ICriteria API. You can see and explanation of the job here. Now I?ve committed a complement to enable that use into the IQuery API, for those who prefer to [...]]]></description>
			<content:encoded><![CDATA[<p>A few days ago Oren Eini and Davy Brion were working in a new feature for NH 2.1 (no a release yet) called Future, in the <em>ICriteria</em> API. You can see and explanation of the job <a href="http://nhforge.org/blogs/nhibernate/archive/2009/01/25/nhibernate-and-future-queries.aspx">here</a>. Now I?ve committed a complement to enable that use into the <em>IQuery</em> API, for those who prefer to use HQL.</p>
<p>What is Future Query anyway? Future are queries that are kept, waiting to be executed as a group in just one roundtrip, making use of an underlying NHibernate feature: <em>MultiCriteria/MultiQuery</em>.</p>
<p>Let?s have a look to this simple piece of code. You can see both queries sentences, and both are executed in that sentence point against the database producing 2 roundtrips to the database. Nothing weird about this, but what if we can just execute the queries in just one roundtrip?</p>
<p><img src="http://darioquintana.com.ar/files/future01.png" /> </p>
<p>And now, using Future we can hold the execution, in this case just two, but we can hold how many queries we need. </p>
<p>Where is the trick? <em>Future</em> method is returning a delayed enumerable implementation, that?s all. When you iterate the enumerable (with a <em>foreach</em> for example), it detects and execute all the queries using a NHibernate-MultiQuery command (could be a MultiCriteria, it depends what we are using). But we don?t need to know nothing about the underlying implementation, just the concept.</p>
<p><img src="http://darioquintana.com.ar/files/future02.png" /> </p>
<p>In other terms, this is what happens behind the scenes:</p>
<p><img src="http://darioquintana.com.ar/files/future03.png" /> </p>
<p>But what if we want to retrieve an entity or a scalar ? This is too simple for an IEnumerable. Thanks to Davy Brion we have another feature called FutureValue. The mechanism is the same as Future, but instead of expect a IEnumerable, we obtain a single value (an entity or a scalar).</p>
<p><img src="http://darioquintana.com.ar/files/future04.png" /></p>
<p><strong>Note</strong>: examples adapted from Davy Brion posts <a href="http://davybrion.com/blog/2009/01/nhibernate-and-future-queries/">[1]</a> and <a href="http://davybrion.com/blog/2009/01/nhibernate-and-future-queries-part-2/">[2]</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2009/01/29/futuret-queries-with-hql-and-criteria/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>NHibernate isn&#8217;t integrated to the compiler, so what?</title>
		<link>http://darioquintana.com.ar/blogging/2008/09/04/nhibernate-isnt-integrated-to-the-compiler-so-what/</link>
		<comments>http://darioquintana.com.ar/blogging/2008/09/04/nhibernate-isnt-integrated-to-the-compiler-so-what/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 22:35:21 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=53</guid>
		<description><![CDATA[I know, this title sound like: &#8220;hmm?&#8221; Let me explain it with more detail.
NHibernate is a framework that use natively Xml in order to configure a mapping between objects and tables, is in charged of join these different worlds. 
But now, what is going wrong with this? Many people can say that Xml files are [...]]]></description>
			<content:encoded><![CDATA[<p>I know, this title sound like: &#8220;hmm?&#8221; Let me explain it with more detail.</p>
<p>NHibernate is a framework that use natively Xml in order to configure a mapping between objects and tables, is in charged of join these different worlds. </p>
<p>But now, what is going wrong with this? Many people can say that Xml files are evil, because you should write a lot of lines, and when you build your project, the compiler doesn&#8217;t know if its ok or not, you have none errors. And this is true, you should run your project and see what happen in runtime, and to get an error in runtime is just annoying.</p>
<p>But now, do we have another alternative to this? Yes of course. Lets go to details. NHibernate has a &#8220;compiler&#8221; too, and you can guess what it is: BuildSessionFactory() method. You don&#8217;t have to launch the whole application to know if your mapping is working well. A way to know if everything is ok is create a test like this:</p>
<p><img src="http://darioquintana.com.ar/files/CanBuild.png"></p>
<p>Then you just need to build the project, and run this simple and fool test, if your code pass though this, your mappings are ok.</p>
<p>We should remember one thing, you can map into Xml not just entities, you can map queries too (and another stuff that isn&#8217;t part of this matter). To map queries into Xml it calls: <a href="http://nhforge.org/doc/nh/en/#manipulatingdata-queryinterface">Named Queries</a>, and in <a href="http://darioquintana.com.ar/blogging/?p=7">this post</a> we talk about this matter. But the main point is, mapping the queries you will know if them are well formed when BuildSessionFactory() is raised, besides another beauties discussed in that post.</p>
<p>Another thing you should remember is you MUST use the Xsd to validate the mapping file. This is mandatory if you&#8217;re using NHibernate and you want to spend time programming instead of dealing with mapping errors (and here they come even with not-well-formed xmls). But this is topic to an How to or another post.</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2008/09/04/nhibernate-isnt-integrated-to-the-compiler-so-what/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
