Getting Started with the NHibernate Designer
The Mindscape NHibernate Designer installs into Visual Studio 2010. To use the designer, open or create a C# or Visual Basic project (typically a Class Library project), right-click the project in Solution Explorer and choose Add > New Item.
From the Add Item dialog, choose NHibernate Model.
Visual Studio creates an empty NHibernate designer model. There are two ways of populating the model.
First, you can drag tables from Server Explorer (database-first development):
Second, you can drag entities and associations from the Toolbox and define their attributes using the designer (model-first development):
Of course, you can use a mix of these two styles, for example dragging tables to create the initial model then editing the entities in the designer.
To configure entities, associations or properties, use the Properties window:
As you edit and save the model, the NHibernate Designer automatically generates C# or Visual Basic classes for you to use in your application code, and creates the NHibernate database mappings for these classes.
The designer can also help create configuration file entries and sample code for your NHibernate session setup. To get this, right-click the model and choose Get Started.
As you make changes to your model, either database-first or model-first, you can keep the model and the database in sync using the Update commands: