by Mikael Henriksson
8. May 2009 00:13
By coincidence I found something called Fluent NHibernatewow automatic mappings etc. After having a read up on NHibernateI also found something called NHibernate Validationthat seemed to serve my purposes well. The only reason for having a look around was to easily add validation to my classes. I found this a bit hard with Entity Framework.
All was well and good I started of with learning how to map entities with fluent. After a couple of hours I had produced a model that I could use. Then I hooked in the validation dll. Tried to validate one of my entities with an attribute. I am not very fond of the whole xml configuration thing to tell you the truth. It’s more work in the long run. I find that if I need to change something I am changing at code level so I might as well change the attribute! Anyway, when I try to instantiate the ValidatorEngie with:
var validator = new ValidatorEngine();
It throws an exception! It’s due to using an older version of NHibernate so I try to upgrade NHibernate and then everything else starts throwing exceptions or complaining about versions. I added some version remaps in the app.config but not luck.
That’s the time I stop trying and go back to Entity Framework. Even if it is still a bit immature it is a piece of cake setting up even for more advanced scenarios and with version 2 on the way I rather have to quickly create a validation service than have to get in to every single detail about NHibernate!
Thanks but no thanks!