【发布时间】:2011-01-27 10:14:16
【问题描述】:
线
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Product>()
它有什么作用?它会在 Product 类的程序集中查找派生自 ClassMap 的任何类吗?或者背后的逻辑是什么?我可以在此处放置该程序集的任何随机类并期望它找到该程序集中的所有映射类吗?
private static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2008
.ConnectionString(Properties.Settings.Default.FnhDbString)
.Cache(c => c
.UseQueryCache()).ShowSql())
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<Product>()
.Conventions.Add(FluentNHibernate.Conventions.Helpers.DefaultLazy.Never()))
.BuildSessionFactory();
}
【问题讨论】:
标签: c# .net nhibernate fluent-nhibernate nhibernate-mapping