現在、プロジェクトで NHibernate + ASP.NET MVC 3 を使用しています。常に、次のように SchemaExport を設定する必要がある新しいクラス モデルを追加します。
Fluently
.Configure()
.Database(MsSqlConfiguration.MsSql2008.ConnectionString(connectionString).ShowSql())
.Mappings(m => m.FluentMappings
.AddFromAssembly(typeof(Usuario).Assembly)
.AddFromAssembly(typeof(Empresa).Assembly)
.AddFromAssembly(typeof(TipoUsuario).Assembly))
.ExposeConfiguration(config =>
{
var schemaExport = new SchemaExport(config);
schemaExport.Drop(true, true);
schemaExport.Create(true, true);
})
schemaExport が新しいモデルをエクスポートするたびに、いくつかのテーブルにデフォルト値のコレクションを挿入する方法はありますか?