Fluent Nhibernate でデータベーススキーマを自動的に作成する方法は? 私の構成は次のとおりです。
public static ISessionFactory CreateDatabase() {
switch (4) {
case 4: // Postgress
_sessionFactory = Fluently.Configure()
.Database(PostgreSQLConfiguration.PostgreSQL82.ConnectionString(ConnectionString))
.ExposeConfiguration(c => {
c.SetProperty("cache.use_second_level_cache", "false");
c.SetProperty("cache.use_query_cache", "false");
})
.ExposeConfiguration(SchemaMetadataUpdater.QuoteTableAndColumns)
.ExposeConfiguration(x => new SchemaUpdate(x).Execute(false, true))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Pessoa>())
.CurrentSessionContext<WebSessionContext>()
.BuildConfiguration()
.BuildSessionFactory();
break;
}
_sessionFactory.Dispose();
return _sessionFactory;
}
現在、NpgsqlCommand を使用して作成するメソッドがあります。