ActiveWriter for NHibernate
It leverages the DSL functionality to allow you to model classes and relationships and it generates the NHibernate mapping and class files (in VB or C#).
I think this has the potential to meet all my requirements for doing the hard work of class and mapping generation.
One thing that is missing at the moment, is that if you drop tables onto the design surface one at a time, they don’t automatically add relations with existing classes. I did discover yesterday that if you drop multiple tables at the same time, it does figure out the relations and add them in.
One of my patches adds support to clean up the class property names. If your database naming strategy means that your column names have some kind of common prefix, you probably don’t want that in the property name.
For example, given the following database table:
CREATE TABLE [dbo].[TEST_CONTENT]
[TC_ID] [int] IDENTITY(1,1) NOT NULL,
[TC_TEST] [int] NOT NULL,
[TC_CONTENT] [int] NOT NULL
If you set the model’s “Property Name Filter Expression” property to the regular expression
^\w+?_ it will then remove the text up to the first underscore for each property name, so that you end up with a class like this:
- Add relations when dropping additional tables
- Support for custom types for properties
- Auto-arrange model layout