FluentNhibernate,从多个程序集中添加映射 [英] FluentNhibernate, add mappings from multiple assemblies
本文介绍了FluentNhibernate,从多个程序集中添加映射的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我尝试通过使用多个.Mappings扩展调用手动添加映射类,但似乎只包括最后一个.那么,如何添加几个选定的类映射或多个程序集呢?
I've tried to add mapping classes manually, by using multiple .Mappings extension calls, but it seems only to include the last one. So how do I add several selected class maps, or multiple assemblies?
我的流利配置通常如下所示:
My fluent configuration looks typically like this:
Return Fluently.Configure() _
.Database(SQLiteConfiguration.Standard.ConnectionString(connectionString) _
.Cache(Function(c) c.UseQueryCache())) _
.Mappings(Function(m) m.FluentMappings.AddFromAssemblyOf(Of AccountMap)() _
.Conventions.Add(FluentNHibernate.Conventions.Helpers.DefaultLazy.Never())) _
.ExposeConfiguration(Function(c) InlineAssignHelper(cfg, c)) _
.BuildSessionFactory()
推荐答案
只需指定所有程序集即可.
Just specify all of your assemblies.
m.FluentMappings
.AddFromAssemblyOf(Of AccountMap)()
.AddFromAssemblyOf(Of SomeOtherMap)();
这篇关于FluentNhibernate,从多个程序集中添加映射的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文