<?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; db4o</title>
	<atom:link href="http://darioquintana.com.ar/blogging/category/db4o/feed/" rel="self" type="application/rss+xml" />
	<link>http://darioquintana.com.ar/blogging</link>
	<description>at blogging</description>
	<lastBuildDate>Mon, 30 Apr 2012 07:05:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<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[<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> [...]]]></description>
			<content:encoded><![CDATA[<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>1</slash:comments>
		</item>
		<item>
		<title>Db4o &#8211; Field Generation support</title>
		<link>http://darioquintana.com.ar/blogging/2008/03/29/db4o-field-generation-support/</link>
		<comments>http://darioquintana.com.ar/blogging/2008/03/29/db4o-field-generation-support/#comments</comments>
		<pubDate>Sat, 29 Mar 2008 07:27:32 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[db4o]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=29</guid>
		<description><![CDATA[<p>I think the field generation in Db4o could be a cool feature. When I talk about field generation is a kind of interception before save/update on an object letting to a generator set a value on a specified field.</p> <p>The field generation is not a primary key generation! Maybe, this feature may able make more [...]]]></description>
			<content:encoded><![CDATA[<p>I think the field generation in Db4o could be a cool feature. When I talk about field generation is a kind of interception before save/update on an object letting to a generator set a value on a specified field.</p>
<p>The field generation is not a primary key generation! Maybe, this feature may able make more easier the implementation of an Auto-Increment field generation for example. </p>
<p>Like an exercise, and to learn about the inside-of-Db4o I&#8217;ve implemented this feature in an a local working copy. Let see some code and how to use it.</p>
<p>First, to be able to create field generators you have to implement your own generator via the interface <em>IFieldGenerator</em>. And this is a simple example of an generator: a Guid generator.</p>
<p><img src="http://uooopaa.googlepages.com/fieldGenerationGuidGenerator.png"> </p>
<p>Now, lets see the objects where the generation should occur. We have an hierarchy of Animal &lt;- Dog.</p>
<p><img src="http://uooopaa.googlepages.com/fieldGenerationClassDiagram.png">&nbsp;<img src="http://uooopaa.googlepages.com/fieldGenerationClass.png"></p>
<p>Now we want to inject a value into the field <em>id</em> before an object-Insert. For make this happen we must to configured Db4o with a code like this:</p>
<p><img src="http://uooopaa.googlepages.com/fieldGenerationConfig.png"> </p>
<p>And that&#8217;s all. Before of an Insert, the object will be injected with a new Guid value. Lets see the code in action in a test method:</p>
<p>&nbsp;<img src="http://uooopaa.googlepages.com/fieldGenerationTestCase.png"> </p>
<p>An interesting point here is the polimorphistic behavior: we have configured the Animal class, and later the field is injected in a instance of a Dog class.</p>
<p>You can configure this feature using attributes/annotations. In order to do that you on have to denote the class with the attribute <em>GeneratorAttribute</em>. And this attribute receive the parameter of the generator.</p>
<p><img src="http://uooopaa.googlepages.com/fieldGenerationClassWithAttribute.png"> </p>
<p><em>GeneratorAttribute</em> make the magic because it just inherit from <em>IDb4oAttribute</em> interface, and later via the <em>ConfigurationIntrospector </em>we configure Db4o as usual<em>.</em> Cool isn&#8217;t ?</p>
<h4><a href="http://darioquintana.googlecode.com/files/Db4o.Demo.FieldGenerator.zip">[Download the example]</a></h4>
<p>And apply <a href="http://darioquintana.googlecode.com/files/FieldGeneration_10450.patch">this patch</a> at the revision 10450 in order to see the changes on the code.</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2008/03/29/db4o-field-generation-support/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>dVP 2008</title>
		<link>http://darioquintana.com.ar/blogging/2007/08/16/dvp-2008/</link>
		<comments>http://darioquintana.com.ar/blogging/2007/08/16/dvp-2008/#comments</comments>
		<pubDate>Thu, 16 Aug 2007 23:32:47 +0000</pubDate>
		<dc:creator>Dario</dc:creator>
				<category><![CDATA[db4o]]></category>

		<guid isPermaLink="false">http://darioquintana.com.ar/blogging/?p=10</guid>
		<description><![CDATA[<p></p> <p>I was honored as dVP 2008, thanks to <a href="http://www.db4o.com">db4o</a> and their community. This is the list of <a href="http://www.db4o.com/community/professionals/dVP/directory2008.aspx">db4o 2008</a>.</p>]]></description>
			<content:encoded><![CDATA[<p><img src="http://developer.db4o.com/utility/roleicons/6485ddc7-f7c3-4b91-b657-7ef1adc5b146.gif" alt="dVP 2008" /></p>
<p>I was honored as dVP 2008, thanks to <a href="http://www.db4o.com">db4o</a> and their community. This is the list of <a href="http://www.db4o.com/community/professionals/dVP/directory2008.aspx">db4o 2008</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://darioquintana.com.ar/blogging/2007/08/16/dvp-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

