FluentNhibernate,添加来自多个程序集的映射
我尝试通过使用多个 .Mappings 扩展调用来手动添加映射类,但似乎只包含最后一个。那么如何添加多个选定的类映射或多个程序集呢?
我的流畅配置通常如下所示:
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()
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()
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
只需指定所有程序集即可。
Just specify all of your assemblies.
看起来很多人,包括我自己,都没有找到一个完整的解决方案来添加所有匿名的程序集,并将其放入 bin 文件夹中。无论如何,我这样做了,它不是最佳的,但它是一个解决方案..
阅读更多关于 NoEntity 此处。
It looks like a lot of people including myself, doesn't find a complete solution to add all assemblies dropped in bin folder if they are anonymous. Anyhow, i did it like this, it's not optimal but its a solution..
Read more about NoEntity here.