我正在使用Fluent NHibernate配置我的数据库。这就是我在createSessionFactory
方法中所拥有的。
private static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2012
.ConnectionString(c => c
.FromConnectionStringWithKey("connectionStringKey"))
.Mappings(m =>
m.FluentMappings.AddFromAssemblyOf<Program>())
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory());
}
我在fluentMappings
下收到错误,它说:
Mappings ConfigurationProperties不包含FluentMappings的定义
答案 0 :(得分:1)
You are missing a parenthesis
private static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(FluentNHibernate.Cfg.Db.MsSqlConfiguration.MsSql2012
.ConnectionString(c => c.FromConnectionStringWithKey("connectionStringKey")))
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Program>())
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
}