如何配置与MySQL功能NHibernate [英] How to configure fluent nHibernate with MySQL
本文介绍了如何配置与MySQL功能NHibernate的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想NHibernate的配置为使用MySQL数据库。我发现MSSQL和SQLite,但没有对MySQL的例子。
所以,我该如何改变这种做法,它使用MySQL的:
Fluently.Configure()数据库(
MsSqlConfiguration.MsSql2005.ConnectionString(
C => c.FromConnectionStringWithKey(的ConnectionString)
)
)
.Mappings(M = GT; m.FluentMappings.AddFromAssemblyOf< MyAutofacModule>())
.BuildSessionFactory())
解决方案
修改 MsSqlConfiguration.MsSql2005
,到 MySqlConfiguration.Standard
,这是一件事我对这个项目做出了贡献。
例如:
Fluently.Configure()数据库(
MySqlConfiguration.Standard.ConnectionString(
C => c.FromConnectionStringWithKey(的ConnectionString)
)
)
.Mappings(M = GT; m.FluentMappings.AddFromAssemblyOf< ; MyAutofacModule>())
.BuildSessionFactory())
I'm trying to configure nHibernate to use a MySql database. I found examples for mssql and sqlite but none for mysql. So, how do I change this so it uses mysql:
Fluently.Configure().Database(
MsSqlConfiguration.MsSql2005.ConnectionString(
c => c.FromConnectionStringWithKey("ConnectionString")
)
)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyAutofacModule>())
.BuildSessionFactory())
解决方案
Change MsSqlConfiguration.MsSql2005
, to MySqlConfiguration.Standard
, it was the one thing I contributed to the project.
Example:
Fluently.Configure().Database(
MySqlConfiguration.Standard.ConnectionString(
c => c.FromConnectionStringWithKey("ConnectionString")
)
)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyAutofacModule>())
.BuildSessionFactory())
这篇关于如何配置与MySQL功能NHibernate的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文