I am attempting to use NHibernate for a new application. The goal is to create tables with NH. I have two questions:
How is this done, if it can be done.
How does this change my configuration section in the app.config?
I am attempting to use NHibernate for a new application. The goal is to create tables with NH. I have two questions:
How is this done, if it can be done.
How does this change my configuration section in the app.config?
Sounds like you are looking to do a SchemaExport
Example:
new SchemaExport(cfg).Execute(false, true, false, false);
Where cfg
is your NHibernate configuration object.
This is covered well about 1/3 of the way down on this NHibernate Forge article: http://nhforge.org/wikis/howtonh/your-first-nhibernate-based-application.aspx
The text their reads:
The fourth line of code uses the SchemaExport helper class of NHibernate to auto-"magically" generate the schema in the database for us. SchemaExport will create the product table in the database and each time you call it it will delete the table and the table data and recreate it.
Look at NHibernate Fluent: http://wiki.fluentnhibernate.org/Getting_started