<?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.Validator</title>
	<atom:link href="http://darioquintana.com.ar/blogging/category/nhibernate/nhibernatevalidator/feed/" rel="self" type="application/rss+xml" />
	<link>http://darioquintana.com.ar/blogging</link>
	<description>at blogging</description>
	<lastBuildDate>Mon, 18 Apr 2011 04:31:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
		<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[<a href="http://darioquintana.com.ar/blogging/2009/10/26/nhibernate-validator-1-2-beta3-released/" title="NHibernate Validator 1.2 Beta3 released"></a>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[<a href="http://darioquintana.com.ar/blogging/2009/10/26/nhibernate-validator-1-2-beta3-released/" title="NHibernate Validator 1.2 Beta3 released"></a><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[<a href="http://darioquintana.com.ar/blogging/2009/10/10/nhibernate-validator-1-2-beta2-released/" title="NHibernate Validator 1.2 Beta2 released"></a>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[<a href="http://darioquintana.com.ar/blogging/2009/10/10/nhibernate-validator-1-2-beta2-released/" title="NHibernate Validator 1.2 Beta2 released"></a><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[<a href="http://darioquintana.com.ar/blogging/2009/05/18/nhibernate-validator-quickstart/" title="NHibernate Validator Quickstart"></a>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 &#8230;<p class="read-more"><a href="http://darioquintana.com.ar/blogging/2009/05/18/nhibernate-validator-quickstart/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://darioquintana.com.ar/blogging/2009/05/18/nhibernate-validator-quickstart/" title="NHibernate Validator Quickstart"></a><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[<a href="http://darioquintana.com.ar/blogging/2009/04/02/nhibernate-validator-and-aspnet-mvc/" title="NHibernate Validator and Asp.Net MVC"></a> 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 &#8230;<p class="read-more"><a href="http://darioquintana.com.ar/blogging/2009/04/02/nhibernate-validator-and-aspnet-mvc/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://darioquintana.com.ar/blogging/2009/04/02/nhibernate-validator-and-aspnet-mvc/" title="NHibernate Validator and Asp.Net MVC"></a><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>11</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[<a href="http://darioquintana.com.ar/blogging/2009/03/30/nhibernate-validator-12-alpha3/" title="NHibernate Validator 1.2 alpha3"></a>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 &#8230;<p class="read-more"><a href="http://darioquintana.com.ar/blogging/2009/03/30/nhibernate-validator-12-alpha3/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://darioquintana.com.ar/blogging/2009/03/30/nhibernate-validator-12-alpha3/" title="NHibernate Validator 1.2 alpha3"></a><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[<a href="http://darioquintana.com.ar/blogging/2009/03/16/new-nhibernate-and-nhibernate-validator-releases/" title="New NHibernate and NHibernate Validator releases"></a>NHibernate 2.1 alpha1. See official release. Download. NHibernate.Validator 1.2 alpha1. See official release. Download.]]></description>
			<content:encoded><![CDATA[<a href="http://darioquintana.com.ar/blogging/2009/03/16/new-nhibernate-and-nhibernate-validator-releases/" title="New NHibernate and NHibernate Validator releases"></a><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>NHibernate Validator 1.0 CR1</title>
		<link>http://darioquintana.com.ar/blogging/2008/08/25/nhibernate-validator-10-cr1/</link>
		<comments>http://darioquintana.com.ar/blogging/2008/08/25/nhibernate-validator-10-cr1/#comments</comments>
		<pubDate>Mon, 25 Aug 2008 20:41:47 +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=47</guid>
		<description><![CDATA[<a href="http://darioquintana.com.ar/blogging/2008/08/25/nhibernate-validator-10-cr1/" title="NHibernate Validator 1.0 CR1"></a>I hope you enjoy this brandnew release of this amazing validator framework. Comes with more stability, more documentation, examples, and the most important point is the full compliance with NHibernate 2.0 GA. Issues as usual must be reported in our &#8230;<p class="read-more"><a href="http://darioquintana.com.ar/blogging/2008/08/25/nhibernate-validator-10-cr1/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://darioquintana.com.ar/blogging/2008/08/25/nhibernate-validator-10-cr1/" title="NHibernate Validator 1.0 CR1"></a><p><img src="http://darioquintana.com.ar/files/NHV-logo-white-background.png"> </p>
<p>I hope you enjoy this brandnew release of this amazing validator framework. Comes with more stability, more documentation, examples, and the most important point is the full compliance with <a href="http://sourceforge.net/project/platformdownload.php?group_id=73818">NHibernate 2.0 GA</a>.</p>
<p>Issues as usual must be reported in <a href="http://jira.nhibernate.org/browse/NHV">our issue-tracker</a>.</p>
<h4><a href="http://sourceforge.net/project/showfiles.php?group_id=216446&amp;package_id=275108">Binaries, source and examples: download it here !</a></h4>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2008/08/25/nhibernate-validator-10-cr1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beta1: NHibernate 2.0 y NHibernate Contrib Releases</title>
		<link>http://darioquintana.com.ar/blogging/2008/07/01/beta1-nhibernate-20-y-nhibernate-contrib-releases/</link>
		<comments>http://darioquintana.com.ar/blogging/2008/07/01/beta1-nhibernate-20-y-nhibernate-contrib-releases/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 16:52:41 +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=41</guid>
		<description><![CDATA[<a href="http://darioquintana.com.ar/blogging/2008/07/01/beta1-nhibernate-20-y-nhibernate-contrib-releases/" title="Beta1: NHibernate 2.0 y NHibernate Contrib Releases"></a>Enjoy ! NHibernate 2.0 beta1 NHibernate Validator 1.0 beta1 NHibernate Mapping Attributes for NH Beta1]]></description>
			<content:encoded><![CDATA[<a href="http://darioquintana.com.ar/blogging/2008/07/01/beta1-nhibernate-20-y-nhibernate-contrib-releases/" title="Beta1: NHibernate 2.0 y NHibernate Contrib Releases"></a><p>Enjoy !</p>
<h2><a href="http://sourceforge.net/project/platformdownload.php?group_id=73818">NHibernate 2.0 beta1</a></h2>
<h2><a href="https://sourceforge.net/project/showfiles.php?group_id=216446&amp;package_id=275108&amp;release_id=610614">NHibernate Validator 1.0 beta1</a></h2>
<h2><a href="https://sourceforge.net/project/showfiles.php?group_id=216446&amp;package_id=282319&amp;release_id=610339">NHibernate Mapping Attributes for NH Beta1</a></h2>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2008/07/01/beta1-nhibernate-20-y-nhibernate-contrib-releases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NHibernate Validator Documentation released</title>
		<link>http://darioquintana.com.ar/blogging/2008/06/02/nhibernate-validator-documentation-released/</link>
		<comments>http://darioquintana.com.ar/blogging/2008/06/02/nhibernate-validator-documentation-released/#comments</comments>
		<pubDate>Mon, 02 Jun 2008 12:11:18 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[NHibernate.Validator]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=40</guid>
		<description><![CDATA[<a href="http://darioquintana.com.ar/blogging/2008/06/02/nhibernate-validator-documentation-released/" title="NHibernate Validator Documentation released"></a>Here is the promised documentation of NHibernate.Validator 1.0.0 Alpha1. You can download it here in different formats: html, pdf and the API via .chm Download documentation]]></description>
			<content:encoded><![CDATA[<a href="http://darioquintana.com.ar/blogging/2008/06/02/nhibernate-validator-documentation-released/" title="NHibernate Validator Documentation released"></a><p><img src="http://uooopaa.googlepages.com/NHV-logo-white-background.png"> </p>
<p>Here is the promised documentation of NHibernate.Validator 1.0.0 Alpha1. You can download it here in different formats: <em>html</em>, <em>pdf</em> and the API via .<em>chm</em></p>
<h4><a href="http://downloads.sourceforge.net/nhcontrib/NHibernate.Validator-1.0.0.Alpha1-doc.zip">Download documentation</a></h4>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2008/06/02/nhibernate-validator-documentation-released/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Integrating NHibernate.Validator with Db4o</title>
		<link>http://darioquintana.com.ar/blogging/2008/05/22/integrating-nhibernatevalidator-with-db4o/</link>
		<comments>http://darioquintana.com.ar/blogging/2008/05/22/integrating-nhibernatevalidator-with-db4o/#comments</comments>
		<pubDate>Thu, 22 May 2008 04:48:33 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[db4o]]></category>
		<category><![CDATA[NHibernate.Validator]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=37</guid>
		<description><![CDATA[<a href="http://darioquintana.com.ar/blogging/2008/05/22/integrating-nhibernatevalidator-with-db4o/" title="Integrating NHibernate.Validator with Db4o"></a>For who isn&#8217;t familiar with NHibernate Validator: it&#8217;s a cool framework to validate objects anywhere at our applications. That&#8217;s it. Now, how we can integrate this tool in order to validate the objects before save/update at Db4o? The answer is: &#8230;<p class="read-more"><a href="http://darioquintana.com.ar/blogging/2008/05/22/integrating-nhibernatevalidator-with-db4o/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://darioquintana.com.ar/blogging/2008/05/22/integrating-nhibernatevalidator-with-db4o/" title="Integrating NHibernate.Validator with Db4o"></a><p>For who isn&#8217;t familiar with <a href="http://darioquintana.com.ar/blogging/?p=35">NHibernate Validator</a>: it&#8217;s a cool framework to validate objects anywhere at our applications. That&#8217;s it.</p>
<p>Now, how we can integrate this tool in order to validate the objects before save/update at <a href="http://www.db4o.com">Db4o</a>? The answer is: very easy. You can download the code at the end of the post.</p>
<p>Remember you can configure <em>NHibernate Validator</em> using .Net Attributes or Xml files. In this case we will se how to do it using the first approach. The class Customer should look like this:</p>
<p><img src="http://uooopaa.googlepages.com/ValidatorWinform_Class.png" alt="" /></p>
<p>Now how to make the integration using a little helper class ? Like this:</p>
<p><img src="http://uooopaa.googlepages.com/Db4oValidator-Configuring.png" alt="" /></p>
<p>As you see, with a little helper class we can configure the integration with only one line of code, very easy. In this line the method Initialize register <em>before</em> events on the Save/Update at the <em>Db4o</em> Core.</p>
<p>Now, let&#8217;s see the validation in action, the below example show the application trying to save an object with an invalid state:</p>
<p><img src="http://uooopaa.googlepages.com/Db4oValidator-inAction.png" alt="" /></p>
<p>So when the Save/Update is going to happen, first of all,<em> NHibernate Validator</em> check if the entity is into a valid state, if it&#8217;s not, an <em>InvalidStateException</em> is thrown, then Db4o wrap it with an <em>EventException</em>, so we have to unwrap the exception to recover the invalid values to display to the user. Would be nice that Db4o don&#8217;t wrap the exceptions, but this topic was discussed on this <a href="http://developer.db4o.com/forums/thread/48980.aspx">thread</a>.</p>
<p>So, was easy to integrate NHibernate Validator with Db4o. Wasn&#8217;t it ?</p>
<h4><a href="http://darioquintana.googlecode.com/files/NHibernate.Validator.Db4o.Demo.zip">Download the Example</a></h4>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2008/05/22/integrating-nhibernatevalidator-with-db4o/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

