Category Archives: NHibernate

nhforge.org is ready !

Ok, this is what we were looking for a long time in the NHibernate community and I think we making it good. These past weekend, after a huge configuration process everybody can say: NHForge is up !

www.nhforge.org

Why nhforge? I think the “welcome” in the home site says enough.

There is something you should do if you are interested in NHibernate,you MUST suscribe to this feed: NHibernate blog.

NHibernate: Almost 2000 downloads on 3 days

In these 3 days NHibernate since the official release NHibernate 2.0 GA reached almost 2000 downloads. IMHO is a nice start for a .Net ORM tool.

What comes with this release

How much has change NHibernate since 1.2.1 till 2.0 GA ?

Patrick Smacchia sent me this link where NHibernate 1.2.1 GA and 2.0 GA are analyzed with NDepend.

I want to you appreciate the analysis made with this tool, to see how much of details it offers to build comparatives between both releases. What I consider the most important is the analysis of the changes made. You will see in the picture with the blue zones, all the refactored parts, and you can arrive to conclusions :)

NHibernate 2.0: Changes Overview

NHibernate Validator 1.0 CR1

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 issue-tracker.

Binaries, source and examples: download it here !

NHibernate: How much slow because the use of reflection?

NHibernate (as a lot of frameworks of IoC) has reflection optimizers to create objects, set and get field/properties. So you don’t have to be worried about that matter: NHibernate isn’t using a plain reflection approach.

This could be an very good argument at the time to “sell NHibernate” to: a customer, a Company or my boss. Have a look on the results of a demo proyect:

As you can see the use of the reflection optimized is faster than the use of reflection. Obviously direct access is the fastest way, but impossible to use in a ORM like NHibernate (as in many other frameworks).

Conclusions

  • Using reflection-optimizer, make the application faster than using of a plain reflection-approach.
  • Field access is faster than property access. This could be a good argument at time to choose field instead of property approach in our mappings files.
  • The obviously but we have to said it: direct access is always the fastest way.

You can download the demo application here.

Thanks to Fabio Maulo to make this example looks nicer. Gracias che !

Beta1: NHibernate 2.0 y NHibernate Contrib Releases

Enjoy !

NHibernate 2.0 beta1

NHibernate Validator 1.0 beta1

NHibernate Mapping Attributes for NH Beta1

NHibernate Validator Documentation released

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

NHibernate FAQ Blog

A lot time ago this blog bring up to us interesting posts about NHibernate, I recommend to you have a look, there a bunch of nice HowTo’s.

Integrating NHibernate.Validator with Db4o

For who isn’t familiar with NHibernate Validator: it’s a cool framework to validate objects anywhere at our applications. That’s it.

Now, how we can integrate this tool in order to validate the objects before save/update at Db4o? The answer is: very easy. You can download the code at the end of the post.

Remember you can configure NHibernate Validator 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:

Now how to make the integration using a little helper class ? Like this:

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 before events on the Save/Update at the Db4o Core.

Now, let’s see the validation in action, the below example show the application trying to save an object with an invalid state:

So when the Save/Update is going to happen, first of all, NHibernate Validator check if the entity is into a valid state, if it’s not, an InvalidStateException is thrown, then Db4o wrap it with an EventException, so we have to unwrap the exception to recover the invalid values to display to the user. Would be nice that Db4o don’t wrap the exceptions, but this topic was discussed on this thread.

So, was easy to integrate NHibernate Validator with Db4o. Wasn’t it ?

Download the Example

NHibernate.Validator 1.0.0 alpha1 released

Finally you can download the first official drop of NHibernate.Validator. This project began as a port of Hibernate.Validator project, but later was growing up on features, and now has a quite different API, optimized to validate objects integrated with NHibernate and objects of any part of our application. NHibernate Validator allow us to validate objects configured using .Net attributes or nhv.xml files.

Download binaries, source and samples here