C# 转换为Fluent NHibernate sessionmanager

C# 转换为Fluent NHibernate sessionmanager,c#,nhibernate,fluent-nhibernate,C#,Nhibernate,Fluent Nhibernate,我正在将我的应用程序更改为使用Fluent NHibernate。我已经创建了Fluent映射文件,现在开始配置会话管理器。目前,我使用以下代码- private ISessionFactory GetSessionFactory() { return (new Configuration()).Configure().BuildSessionFactory(); } 与我的hibernate.cfg.xml一起- <?xml version="1.0" encoding="u

我正在将我的应用程序更改为使用Fluent NHibernate。我已经创建了Fluent映射文件,现在开始配置会话管理器。目前,我使用以下代码-

private ISessionFactory GetSessionFactory()
{
     return (new Configuration()).Configure().BuildSessionFactory();
}
与我的hibernate.cfg.xml一起-

<?xml version="1.0" encoding="utf-8" ?>
<hibernate-configuration xmlns="urn:nhibernate-configuration-2.2" >
  <session-factory>
    <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
    <property name="dialect">NHibernate.Dialect.InformixDialect1000</property>
    <property name="connection.driver_class">NHibernate.Driver.OleDbDriver</property>
    <property name="connection.connection_string">Provider=Ifxoledbc.2;Password=mypass;Persist Security Info=True;User ID=myid;Data Source=mysource</property>

    <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
    <property name="show_sql">false</property>
    <mapping assembly="DataTransfer" />
  </session-factory>
</hibernate-configuration>

NHibernate.Connection.DriverConnectionProvider
NHibernate.dialogue.informix方言1000
NHibernate.Driver.OleDbDriver
Provider=Ifxoledbc.2;密码=mypass;持久安全信息=True;用户ID=myid;数据源=mysource
NHibernate.ByteCode.Castle.proxyFactory,NHibernate.ByteCode.Castle
假的
有人知道我怎样才能把这个传给Fluent吗?我遇到的问题是配置的数据库部分

谢谢你的建议。

因为你需要下载(#680对我有用):

私有ISessionFactory CreateSessionFactory()
{
流畅地返回。Configure()
.数据库(
IfxOdbcConfiguration
.Informix1000
.ConnectionString(“Provider=Ifxoledbc.2;Password=mypass;Persist Security Info=True;User ID=myid;Data Source=mysource”)
.司机()
.方言()
.ProxyFactoryFactory()
)
.映射(
m=>m
.FluentMappings
.AddFromAssemblyOf()的
)
.BuildSessionFactory();
}

jon-以下是我最终使用的-

return Fluently.Configure()
                .Database(
                    IfxOdbcConfiguration
                        .Informix1000
                        .ConnectionString("Provider=Ifxoledbc.2;Password=password;Persist Security Info=True;User ID=username;Data Source=database@server")
                        .Dialect<InformixDialect1000>()
                        .ProxyFactoryFactory<ProxyFactoryFactory>()
                        .Driver<OleDbDriver>()
                        .ShowSql()
                    )
                .Mappings(m => m.AutoMappings.Add(persistenceModel))
                .BuildSessionFactory();
流畅地返回。Configure()
.数据库(
IfxOdbcConfiguration
.Informix1000
.ConnectionString(“Provider=Ifxoledbc.2;Password=Password;Persist Security Info=True;User ID=username;数据源=database@server")
.方言()
.ProxyFactoryFactory()
.司机()
.ShowSql()
)
.Mappings(m=>m.AutoMappings.Add(persistenceModel))
.BuildSessionFactory();
我不确定你到底在找什么,所以请让我知道这是否有效。
谢谢

在上面的示例中,ProxyFactoryFactory类型来自哪里?来自
NHibernate.ByteCode.Castle
程序集。我必须添加.Driver,但除此之外,它似乎还在工作。Thanks@czuroski,说得好,我已经编辑了我的文章来考虑它。谢谢
return Fluently.Configure()
                .Database(
                    IfxOdbcConfiguration
                        .Informix1000
                        .ConnectionString("Provider=Ifxoledbc.2;Password=password;Persist Security Info=True;User ID=username;Data Source=database@server")
                        .Dialect<InformixDialect1000>()
                        .ProxyFactoryFactory<ProxyFactoryFactory>()
                        .Driver<OleDbDriver>()
                        .ShowSql()
                    )
                .Mappings(m => m.AutoMappings.Add(persistenceModel))
                .BuildSessionFactory();