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
I was looking at some T-SQL that RJ had written and noticed he was using ‘True’ and ‘False’ when dealing with bit data types.
I’ve always used 1 and 0, but I think ‘True’ and ‘False’ is more obvious, and I think I’ll start using it from now on.
Sure enough, the SQL 2005 Books Online entry for bit (Transact-SQL) mentions this:
The string values TRUE and FALSE can be converted to bit values: TRUE is converted to 1 and FALSE is converted to 0.
Is it me, or does the guy in this Advertisement for the new Australian Citizenship Test look a bit like Michael Kleef?