The nice thing about the model first approach is that we can instruct NHibernate to automatically generate the creation scripts for the database schema for us. That is, we do not have to manually create the database schema, just let NHibernate figure out how the tables and their relations are going to look. To do its job, NHibernate uses the information we provide when defining the mappings for our domain model.
For this job, NHibernate provides us with a class called
SchemaExport, which expects a
Configuration object as the parameter of its constructor.
var configuration = ... var exporter = new SchemaExport(configuration);
We can then call the
Execute method, which has several overloads. These overloads ...