我正在尝试将 nHibernate 配置为使用 MySql 数据库。我找到了 mssql 和 sqlite 的示例,但没有找到 mysql 的示例。 那么,我该如何更改它以使其使用 mysql:
Fluently.Configure().Database(
MsSqlConfiguration.MsSql2005.ConnectionString(
c => c.FromConnectionStringWithKey("ConnectionString")
)
)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyAutofacModule>())
.BuildSessionFactory())
最佳答案
将 MsSqlConfiguration.MsSql2005
更改为 MySqlConfiguration.Standard
,这是我为项目贡献的一件事。
例子:
Fluently.Configure().Database(
MySqlConfiguration.Standard.ConnectionString(
c => c.FromConnectionStringWithKey("ConnectionString")
)
)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyAutofacModule>())
.BuildSessionFactory())
关于c# - 如何使用 MySQL 配置流畅的 nHibernate,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/626339/