Entity Developer Review, Part 2

Here’s my second post on Entity Developer, this time, focused on NHibernate. You can find the first part here.

I created a new model item of type NHibernate and chose the option to generate from the database:

image

Mind you, you need to have the database providers installed for the databases you want to access, Entity Developer does not include them.I was then presented with a list of database objects:

image

After I selected a few, Entity Developer shows the class and properties naming rules dialog:

image

Next, some more options, pretty complete. Very useful is the option to detect many-to-many associations and table per type inheritances. These will be the default settings, but we can override them on a class by class basis:

image

Interesting, the next dialog gives an opportunity to split entities among different diagrams according to the database object’s schema:

image

Finally, we get to choose the template that will be used to generate the classes (the only included one is for HBM.XML) and set some of its properties, like, generate a single file or one file per entity, implement standard methods such as Equals or GetHashCode, standard interfaces like NHibernate’s IValidatable, ICloneable and INotifyPropertyChanged, add data contract serialization attributes for WCF and add support for a validation framework (NHibernate Validator, Data Annotations or Enterprise Library Validation Application Block):

image

There are several templates available, in both C# and Visual Basic, which we can browse and select (others can be added manually):

The code is immediately generated, unless there are validation errors in the model, like, a table without primary key:

image

In the Model window, selecting a class or a property of a class, we can set its properties, I think all of NHibernate’s features are there, collection types, cascading options, id generators, etc, plus validation settings, which will be translated to the validation framework of choice.

The HBM.XML files are set as embedded resources, which is also nice, and the Web.config file is updated with the connection string to the selected database. Weird, the dialect was set to MsSql2005Dialect, which doesn’t make much sense since I was connecting to SQL Server 2014. It is possible to select another dialect through the user interface, but dialects and drivers appear as text boxes, not much of a help.

All in all, it’s pretty impressive, it seems that all NHibernate features are present – did I mention that it is even possible to configure filters? – making Entity Developer a very interesting product. Another strong point is the T4 template system, which, with some effort, allows us to generate code mappings or whatever we want. The only problem I see is that no template for NHibernate's built-in mapping by code is supplied, although one exists for Fluent NHibernate.

Next, Entity Framework.

                             

No Comments

Add a Comment

As it will appear on the website

Not displayed

Your website